Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
g

Test String

Code Generator

Generated Code

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "\* \[([^\!][^\]]*)\]\(https?\:\/\/github\.com\/([^\/]+\/[^\/\)]+)\/?[^\)]*\)" Local $sString = "# Awesome SSH [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)" & @CRLF & _ "" & @CRLF & _ "> A curated list of *SSH* [apps](#apps), [libraries](#libraries) and [resources](#resources)." & @CRLF & _ "" & @CRLF & _ "<h2 align="center"><img src="https://raw.githubusercontent.com/moul/awesome-ssh/master/logo.jpg" width="400" /></h2>" & @CRLF & _ "" & @CRLF & _ "Inspired by the [awesome](https://github.com/sindresorhus/awesome) list thing." & @CRLF & _ "" & @CRLF & _ "Please read the [contribution guidelines](CONTRIBUTING.md) if you want to contribute." & @CRLF & _ "" & @CRLF & _ "**Check out my [blog](http://manfredtouron.tumblr.com) 🦄 or say *hi* on [Twitter](https://twitter.com/moul).**" & @CRLF & _ "" & @CRLF & _ "## Table of Contents" & @CRLF & _ "" & @CRLF & _ "- [Apps](#apps)" & @CRLF & _ " - [`.ssh/config`](#sshconfig)" & @CRLF & _ " - [Tools using the *SSH* protocol](#tools-using-the-ssh-protocol)" & @CRLF & _ " - [Servers](#servers)" & @CRLF & _ " - [Network](#network)" & @CRLF & _ " - [Multiplexers](#multiplexers)" & @CRLF & _ " - [SSH Keys / Authentication](#ssh-keys--authentication)" & @CRLF & _ " - [SSH agent](#ssh-agent)" & @CRLF & _ " - [Tools](#tools)" & @CRLF & _ " - [Automation](#automation)" & @CRLF & _ " - [Web](#web)" & @CRLF & _ " - [Testing / Honeypots](#testing--honeypots)" & @CRLF & _ " - [Alternatives to SSH](#alternatives-to-ssh)" & @CRLF & _ "- [Libraries](#libraries)" & @CRLF & _ "- [Resources](#resources)" & @CRLF & _ " - [Tutorials](#tutorials)" & @CRLF & _ " - [Security](#security)" & @CRLF & _ " - [Documentation](#documentation)" & @CRLF & _ " - [Community](#community)" & @CRLF & _ "" & @CRLF & _ "## Apps" & @CRLF & _ "" & @CRLF & _ "### `.ssh/config`" & @CRLF & _ "" & @CRLF & _ "* [`assh` a.k.a `advanced-ssh-config`](https://github.com/moul/advanced-ssh-config) - Transparent wrapper (ProxyCommand) that adds regex, aliases, gateways, includes, dynamic hostnames to *SSH* and `ssh-config`." & @CRLF & _ "* [storm](https://github.com/emre/storm) - Manage your *SSH* like a boss." & @CRLF & _ "* [ansible-ssh-config](https://github.com/gaqzi/ansible-ssh-config) - Letting *Ansible* manage `ssh_config`." & @CRLF & _ "* [ec2ssh](https://github.com/mirakui/ec2ssh) - A `ssh_config` manager for *AWS EC2*." & @CRLF & _ "* [ssh-config](https://github.com/dbrady/ssh-config) - A tool to help manage your `.ssh/config` file." & @CRLF & _ "" & @CRLF & _ "### Tools using the *SSH* protocol" & @CRLF & _ "" & @CRLF & _ "* [scp](http://linux.die.net/man/1/scp) - Secure remote file copy utility over *SSH*." & @CRLF & _ "* [rsync](https://rsync.samba.org) - Fast incremental transfer utility that supports *SSH*." & @CRLF & _ "* [sftp](https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol) - File transfer protocol over *SSH*." & @CRLF & _ "* [curl](http://curl.haxx.se) - Command line tool and library to transfer data (support `sftp`)." & @CRLF & _ "" & @CRLF & _ "### Servers" & @CRLF & _ "" & @CRLF & _ "* [ssh2docker](https://github.com/moul/ssh2docker) - *SSH* server to Docker containers." & @CRLF & _ "* [whosthere](https://github.com/FiloSottile/whosthere) - A *SSH* server that knows who you are. `$ ssh whoami.filippo.io`." & @CRLF & _ "* [sshfront](https://github.com/gliderlabs/sshfront) - Programmable *SSH* frontend." & @CRLF & _ "* [ssh-chat](https://github.com/shazow/ssh-chat) - Chat over *SSH*." & @CRLF & _ "* [sshcommand](https://github.com/dokku/sshcommand) - Turn *SSH* into a thin client specifically for your app." & @CRLF & _ "* [sshmuxd](https://github.com/joushou/sshmuxd) - `sshmux` frontend." & @CRLF & _ "* [x84](https://github.com/jquast/x84) - A *python* `telnet`/`ssh` server for modern *UTF-8* and classic *cp437* network virtual terminals. In spirit of classic software such as *ami/x*, *teleguard*, *renegade*, *iniquity*." & @CRLF & _ "* [teleport](https://github.com/gravitational/teleport) - Modern *SSH* server for clusters and teams." & @CRLF & _ "" & @CRLF & _ "### Network" & @CRLF & _ "" & @CRLF & _ "* [Mosh](https://mosh.mit.edu) - The mobile shell." & @CRLF & _ "* [sshfs](https://github.com/libfuse/sshfs) - Filesystem client based on the *SSH* File Transfer Protocol." & @CRLF & _ "* [ngrok](https://github.com/inconshreveable/ngrok) - Introspected tunnels to localhost." & @CRLF & _ "* [localtunnel](https://github.com/progrium/localtunnel) - Expose localhost servers to the Internet." & @CRLF & _ "* [sshuttle](https://github.com/apenwarr/sshuttle) - Transparent proxy server that works as a poor man's *VPN*. Forwards over `ssh`. Doesn't require admin. Works with *Linux* and *MacOS*. Supports *DNS tunneling*." & @CRLF & _ "* [sshttp](https://github.com/stealth/sshttp) - *SSH*/*HTTP(S)* multiplexer. Run a webserver and a `sshd` on the same port w/o changes." & @CRLF & _ "* [switcher](https://github.com/jamescun/switcher) - Run *SSH* and *HTTP(S)* on the same port." & @CRLF & _ "* [sslh](https://github.com/yrutschle/sslh) - Applicative Protocol Multiplexer (i.e: *SSH* + *HTTPS*)." & @CRLF & _ "* [tund](https://github.com/aphyr/tund) - *SSH* reverse tunnel daemon." & @CRLF & _ "* [autossh](http://www.harding.motd.ca/autossh/) - Automatically respawn *SSH* session after network interruption." & @CRLF & _ "* [wssh](https://github.com/aluzzardi/wssh) - *SSH* to WebSockets Bridge." & @CRLF & _ "* [docker-volume-sshfs](https://github.com/vieux/docker-volume-sshfs) - `sshfs` docker volume plugin." & @CRLF & _ "" & @CRLF & _ "### Multiplexers" & @CRLF & _ "" & @CRLF & _ "* [tmux](https://tmux.github.io) - Terminal multiplexer." & @CRLF & _ "* [clusterssh](https://github.com/duncs/clusterssh) - Cluster admin via *SSH*." & @CRLF & _ "* [tmux-cssh](https://github.com/dennishafemann/tmux-cssh) - `tmux` with a *ClusterSSH*-like behavior." & @CRLF & _ "* [tm](https://github.com/Ganneff/tm) - `tmux` manager / helper." & @CRLF & _ "* [i2cssh](https://github.com/wouterdebie/i2cssh) - `csshX` like *SSH* tool for *iTerm2*." & @CRLF & _ "* [ClusterSSH](http://sourceforge.net/projects/clusterssh/) - Controls a number of `xterm` windows via a single graphical console." & @CRLF & _ "" & @CRLF & _ "### *SSH* keys / Authentication" & @CRLF & _ "" & @CRLF & _ "* [authy-ssh](https://github.com/authy/authy-ssh) - Easy *two-factor* authentication for *SSH* servers." & @CRLF & _ "* [github-auth](https://github.com/chrishunt/github-auth) - *SSH* key management for GitHub users." & @CRLF & _ "* [cipherhub](https://github.com/substack/cipherhub) - Encrypt messages based on *SSH* public keys with easy import from GitHub." & @CRLF & _ "* [Slack notifications](http://www.ryanbrink.com/slack-ssh-session-notifications/) - Guide to setup Slack notifications (can be modified for other services)." & @CRLF & _ "* [totp-ssh-fluxer](https://github.com/benjojo/totp-ssh-fluxer) - A way to make sure your `sshd` port changes every 30 seconds." & @CRLF & _ "" & @CRLF & _ "### *SSH* agent" & @CRLF & _ "" & @CRLF & _ "* [ssh-ident](https://github.com/ccontavalli/ssh-ident) - Different agents and different keys for different projects, with `ssh`." & @CRLF & _ "* [oh-my-zsh/plugins/ssh-agent](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ssh-agent) - `ssh-agent` plugin for `zsh`." & @CRLF & _ "" & @CRLF & _ "### Tools" & @CRLF & _ "" & @CRLF & _ "* [sshrc](https://github.com/Russell91/sshrc) - Bring your `.bashrc`, `.vimrc`, etc. with you when you `ssh`." & @CRLF & _ "" & @CRLF & _ "### Automation" & @CRLF & _ "" & @CRLF & _ "* [Ansible](https://github.com/ansible/ansible) - App deployment, configuration management and orchestration over *SSH*." & @CRLF & _ "* [rtop](https://github.com/rapidloop/rtop) - Interactive, remote system monitoring tool based on *SSH*." & @CRLF & _ "* [DSH - Dancer's shell / distributed shell](https://www.netfort.gr.jp/~dancer/software/dsh.html.en) - Wrapper for executing multiple remote shell commands from one command line." & @CRLF & _ "* [parallel-ssh](https://code.google.com/p/parallel-ssh/) - Provides parallel versions of OpenSSH and related tools." & @CRLF & _ "* [SSH Power Tool](https://code.google.com/p/sshpt/) - Execute commands and upload files to many servers simultaneously without using pre-shared keys." & @CRLF & _ "" & @CRLF & _ "### Web" & @CRLF & _ "" & @CRLF & _ "* [Secure Shell chrome extension](https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo?hl=en)" & @CRLF & _ "* [GateOne](https://github.com/liftoff/GateOne) - HTML5-powered terminal emulator and *SSH* client." & @CRLF & _ "* [KeyBox](https://github.com/skavanagh/KeyBox) - Web-based *SSH* console that centrally manages administrative access to systems." & @CRLF & _ "* [Apache Guacamole](https://guacamole.incubator.apache.org/) - Apache Guacamole is a HTML5 based clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH. " & @CRLF & _ "" & @CRLF & _ "### Testing / Honeypots" & @CRLF & _ "" & @CRLF & _ "* [ssh-hammer](https://github.com/shazow/ssh-hammer) - *SSH* load testing tool." & @CRLF & _ "* [kippo](https://github.com/desaster/kippo) - *SSH* Honeypot." & @CRLF & _ "* [cowrie](https://github.com/micheloosterhof/cowrie) - *SSH* Honeypot (based on kippo)." & @CRLF & _ "* [sshmitm](http://linux.die.net/man/8/sshmitm) - *SSH* monkey-in-the-middle." & @CRLF & _ "* [ssh-audit](https://github.com/arthepsy/ssh-audit) - A tool for *SSH* server auditing." & @CRLF & _ "* [sshesame](https://github.com/jaksi/sshesame) - A fake SSH server that lets everyone in and logs their activity." & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "### Alternatives to *SSH*" & @CRLF & _ "" & @CRLF & _ "* [GoTTY](https://github.com/yudai/gotty) - Share your terminal as web application." & @CRLF & _ "* [telnet](http://www.telnet.org/htm/faq.htm) - An unencrypted network protocol and an application used to connect to remote computers and issue commands." & @CRLF & _ "* [rsh](https://en.wikipedia.org/wiki/Remote_Shell) - An unencrypted network protocol and application used to connect to remote computers and issue commands." & @CRLF & _ "" & @CRLF & _ "## Libraries" & @CRLF & _ "" & @CRLF & _ "* C/C++" & @CRLF & _ " * [libssh](https://www.libssh.org) - The *SSH* library." & @CRLF & _ " * [substack/libssh](https://github.com/substack/libssh) - Multiplatform C library implementing the SSHv2 and SSHv1 protocol on client and server side." & @CRLF & _ "* Golang" & @CRLF & _ " * [crypto/ssh](https://godoc.org/golang.org/x/crypto/ssh) - Built-in *SSH* client and server library." & @CRLF & _ " * [sftp](https://github.com/pkg/sftp) - *SFTP* support for the go.crypto/ssh package." & @CRLF & _ " * [go-sshkit](https://github.com/shazow/go-sshkit) - Toolkit for building *SSH* servers and clients in Go." & @CRLF & _ " * [Socker](https://github.com/cosiner/socker) - Library for Go to simplify the use of *SSH*." & @CRLF & _ "* Java" & @CRLF & _ " * [jsch](http://www.jcraft.com/jsch/) - Pure *java*, *BSD* licensed, *SSH2* client library." & @CRLF & _ "* Javascript/Node.js" & @CRLF & _ " * [ssh2](https://github.com/mscdex/ssh2) - *SSH2* client and server modules written in pure *JavaScript* for *node.js*." & @CRLF & _ "* Python" & @CRLF & _ " * [paramiko](https://github.com/paramiko/paramiko) - Native *Python* *SSHv2* protocol library." & @CRLF & _ "* Ruby" & @CRLF & _ " * [net-ssh](https://github.com/net-ssh/net-ssh) - Pure *Ruby* implementation of an *SSH* (protocol 2) client." & @CRLF & _ "" & @CRLF & _ "## Resources" & @CRLF & _ "" & @CRLF & _ "### Tutorials" & @CRLF & _ "" & @CRLF & _ "* [How to use *SSH* to Connect to a Remote Server](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-to-connect-to-a-remote-server-in-ubuntu)" & @CRLF & _ "* [Best practices](https://blog.0xbadc0de.be/archives/300)" & @CRLF & _ "* [Granting Temporary Access to Your Servers (Using Signed *SSH* Keys)](http://linux-audit.com/granting-temporary-access-to-servers-using-signed-ssh-keys/)" & @CRLF & _ "* [How to SSH login without a password](https://www.rosehosting.com/blog/ssh-login-without-password-using-ssh-keys/)" & @CRLF & _ "" & @CRLF & _ "### Security" & @CRLF & _ "" & @CRLF & _ "* [01/14/2016](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-0777) - Integer Overflow `CVE 2016 077[7-8]`." & @CRLF & _ "* [Security/Guidelines/OpenSSH - MozillaWiki](https://wiki.mozilla.org/Security/Guidelines/OpenSSH) - `sshd\_config` for `6.7+`, `5.3`." & @CRLF & _ "* [Applied-Crypto-Hardening](https://github.com/BetterCrypto/Applied-Crypto-Hardening/tree/master/src/configuration/SSH/OpenSSH) - `sshd\_config` for `6.X`" & @CRLF & _ "" & @CRLF & _ "### Documentation" & @CRLF & _ "" & @CRLF & _ "* [man page](http://linux.die.net/man/1/ssh)" & @CRLF & _ "* [Specifications (OpenSSH)](http://www.openssh.com/specs.html)" & @CRLF & _ "* [Wikipedia article](https://en.wikipedia.org/wiki/Secure_Shell)" & @CRLF & _ "" & @CRLF & _ "### Community" & @CRLF & _ "" & @CRLF & _ "* [StackOverflow](http://stackoverflow.com/questions/tagged/ssh)" & @CRLF & _ "* [ServerFault](http://serverfault.com/questions/tagged/ssh)" & @CRLF & _ "" & @CRLF & _ "## License" & @CRLF & _ "" & @CRLF & _ "[![CC0](https://i.creativecommons.org/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/)" & @CRLF & _ "" & @CRLF & _ "To the extent possible under law, [Manfred Touron](https://github.com/moul) has waived all copyright and related or neighboring rights to this work." & @CRLF & _ "" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH) Local $aFullArray[0] For $i = 0 To UBound($aArray) -1 _ArrayConcatenate($aFullArray, $aArray[$i]) Next $aArray = $aFullArray ; Present the entire match result _ArrayDisplay($aArray, "Result")

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm