Regular Expressions 101

Save & Manage Regex

  • Current Version: 2
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
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
Processing...

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 = "(?m)^[\w\d-]*(?=\=)" Local $sString = "# This file may be used to create an environment using:" & @CRLF & _ "# $ conda create --name <env> --file <this file>" & @CRLF & _ "# platform: osx-64" & @CRLF & _ "absl-py=0.7.1=py36_0" & @CRLF & _ "appnope=0.1.0=py36_1000" & @CRLF & _ "asn1crypto=0.24.0=py36_1003" & @CRLF & _ "astor=0.7.1=py_0" & @CRLF & _ "attrs=19.1.0=py_0" & @CRLF & _ "backcall=0.1.0=py_0" & @CRLF & _ "bleach=3.1.0=py_0" & @CRLF & _ "blinker=1.4=py_1" & @CRLF & _ "boto=2.49.0=py_0" & @CRLF & _ "boto3=1.9.210=py_0" & @CRLF & _ "botocore=1.12.210=py_0" & @CRLF & _ "bz2file=0.98=py_0" & @CRLF & _ "c-ares=1.15.0=h01d97ff_1001" & @CRLF & _ "ca-certificates=2019.6.16=hecc5488_0" & @CRLF & _ "certifi=2019.6.16=py36_1" & @CRLF & _ "cffi=1.12.3=py36hccf1714_0" & @CRLF & _ "chardet=3.0.4=py36_1003" & @CRLF & _ "cryptography=2.7=py36h212c5bf_0" & @CRLF & _ "cycler=0.10.0=py_1" & @CRLF & _ "cymem=2.0.2=py36h6de7cb9_0" & @CRLF & _ "cython-blis=0.2.4=py36h01d97ff_1" & @CRLF & _ "decorator=4.4.0=py_0" & @CRLF & _ "defusedxml=0.5.0=py_1" & @CRLF & _ "docutils=0.15.2=py36_0" & @CRLF & _ "en-core-web-lg=2.1.0=pypi_0" & @CRLF & _ "en-core-web-md=2.1.0=pypi_0" & @CRLF & _ "en-core-web-sm=2.1.0=pypi_0" & @CRLF & _ "entrypoints=0.3=py36_1000" & @CRLF & _ "freetype=2.10.0=h24853df_1" & @CRLF & _ "funcy=1.13=py_0" & @CRLF & _ "future=0.17.1=py36_1000" & @CRLF & _ "gast=0.2.2=py_0" & @CRLF & _ "gensim=3.4.0=py36h1de35cc_0" & @CRLF & _ "grpcio=1.22.0=py36h6ef0057_0" & @CRLF & _ "h5py=2.9.0=nompi_py36h6248fd5_1104" & @CRLF & _ "hdf5=1.10.5=nompi_h0cbb7df_1100" & @CRLF & _ "idna=2.8=py36_1000" & @CRLF & _ "ipykernel=5.1.2=py36h5ca1d4c_0" & @CRLF & _ "ipython=7.7.0=py36h5ca1d4c_0" & @CRLF & _ "ipython_genutils=0.2.0=py_1" & @CRLF & _ "jedi=0.15.1=py36_0" & @CRLF & _ "jinja2=2.10.1=py_0" & @CRLF & _ "jmespath=0.9.4=py_0" & @CRLF & _ "joblib=0.13.2=py_0" & @CRLF & _ "jpeg=9c=h1de35cc_1001" & @CRLF & _ "jsonschema=3.0.2=py36_0" & @CRLF & _ "jupyter_client=5.3.1=py_0" & @CRLF & _ "jupyter_core=4.4.0=py_0" & @CRLF & _ "keras-applications=1.0.7=py_1" & @CRLF & _ "keras-preprocessing=1.0.9=py_1" & @CRLF & _ "kiwisolver=1.1.0=py36h770b8ee_0" & @CRLF & _ "libblas=3.8.0=12_openblas" & @CRLF & _ "libcblas=3.8.0=12_openblas" & @CRLF & _ "libcxx=8.0.0=4" & @CRLF & _ "libcxxabi=8.0.0=4" & @CRLF & _ "libffi=3.2.1=h6de7cb9_1006" & @CRLF & _ "libgfortran=3.0.1=0" & @CRLF & _ "liblapack=3.8.0=12_openblas" & @CRLF & _ "libopenblas=0.3.7=hd44dcd8_1" & @CRLF & _ "libpng=1.6.37=h2573ce8_0" & @CRLF & _ "libprotobuf=3.9.1=hfbae3c0_0" & @CRLF & _ "libsodium=1.0.17=h01d97ff_0" & @CRLF & _ "libtiff=4.0.10=hd08fb8f_1003" & @CRLF & _ "lz4-c=1.8.3=h6de7cb9_1001" & @CRLF & _ "markdown=3.1.1=py_0" & @CRLF & _ "markupsafe=1.1.1=py36h1de35cc_0" & @CRLF & _ "matplotlib-base=3.1.1=py36h3a684a6_1" & @CRLF & _ "mistune=0.8.4=py36h1de35cc_1000" & @CRLF & _ "murmurhash=1.0.0=py36h0a44026_0" & @CRLF & _ "nbconvert=5.6.0=py_0" & @CRLF & _ "nbformat=4.4.0=py_1" & @CRLF & _ "ncurses=6.1=h0a44026_1002" & @CRLF & _ "nltk=3.4.4=py_0" & @CRLF & _ "notebook=6.0.0=py36_0" & @CRLF & _ "numexpr=2.7.0=py36h86efe34_0" & @CRLF & _ "numpy=1.17.0=py36h6b0580a_0" & @CRLF & _ "oauthlib=3.0.1=py_0" & @CRLF & _ "olefile=0.46=py_0" & @CRLF & _ "openssl=1.1.1c=h01d97ff_0" & @CRLF & _ "pandas=0.25.0=py36h86efe34_0" & @CRLF & _ "pandoc=2.7.3=0" & @CRLF & _ "pandocfilters=1.4.2=py_1" & @CRLF & _ "parso=0.5.1=py_0" & @CRLF & _ "patsy=0.5.1=py_0" & @CRLF & _ "pexpect=4.7.0=py36_0" & @CRLF & _ "pickleshare=0.7.5=py36_1000" & @CRLF & _ "pip=19.2.2=py36_0" & @CRLF & _ "plac=0.9.6=py36_0" & @CRLF & _ "preshed=2.0.1=py36h6de7cb9_0" & @CRLF & _ "prometheus_client=0.7.1=py_0" & @CRLF & _ "prompt_toolkit=2.0.9=py_0" & @CRLF & _ "protobuf=3.9.1=py36h6de7cb9_0" & @CRLF & _ "ptyprocess=0.6.0=py_1001" & @CRLF & _ "pycountry=19.8.18=pypi_0" & @CRLF & _ "pycparser=2.19=py36_1" & @CRLF & _ "pygments=2.4.2=py_0" & @CRLF & _ "pyjwt=1.7.1=py_0" & @CRLF & _ "pyopenssl=19.0.0=py36_0" & @CRLF & _ "pyparsing=2.4.2=py_0" & @CRLF & _ "pyrsistent=0.15.4=py36h01d97ff_0" & @CRLF & _ "pysocks=1.7.0=py36_0" & @CRLF & _ "python=3.6.7=h94afb7f_1005" & @CRLF & _ "python-dateutil=2.8.0=py_0" & @CRLF & _ "pytz=2019.2=py_0" & @CRLF & _ "pyzmq=18.0.2=py36hee98d25_2" & @CRLF & _ "readline=8.0=hcfe32e1_0" & @CRLF & _ "requests=2.22.0=py36_1" & @CRLF & _ "requests-oauthlib=1.2.0=py_0" & @CRLF & _ "retrying=1.3.3=py_2" & @CRLF & _ "s3transfer=0.2.1=py36_0" & @CRLF & _ "scipy=1.3.1=py36hab3da7d_2" & @CRLF & _ "seaborn=0.9.0=py_1" & @CRLF & _ "send2trash=1.5.0=py_0" & @CRLF & _ "setuptools=41.0.1=py36_0" & @CRLF & _ "simplejson=3.16.1=py36h470a237_0" & @CRLF & _ "six=1.12.0=py36_1000" & @CRLF & _ "smart_open=1.8.4=py_0" & @CRLF & _ "snowballstemmer=1.9.0=py_0" & @CRLF & _ "sortedcollections=1.1.2=py_0" & @CRLF & _ "sortedcontainers=2.1.0=py_0" & @CRLF & _ "spacy=2.1.8=py36h770b8ee_0" & @CRLF & _ "sqlite=3.29.0=hb7d70f7_0" & @CRLF & _ "srsly=0.0.7=py36h6de7cb9_0" & @CRLF & _ "statsmodels=0.10.1=py36heacc8b8_0" & @CRLF & _ "sumy=0.8.1=pypi_0" & @CRLF & _ "tensorboard=1.13.1=py36_0" & @CRLF & _ "tensorflow=1.13.1=py36_1" & @CRLF & _ "tensorflow-estimator=1.13.0=py36h24bf2e0_0" & @CRLF & _ "termcolor=1.1.0=py_2" & @CRLF & _ "terminado=0.8.2=py36_0" & @CRLF & _ "testpath=0.4.2=py_1001" & @CRLF & _ "thinc=7.0.8=py36h770b8ee_0" & @CRLF & _ "tk=8.6.9=h2573ce8_1002" & @CRLF & _ "tornado=6.0.3=py36h01d97ff_0" & @CRLF & _ "tqdm=4.33.0=py_0" & @CRLF & _ "traitlets=4.3.2=py36_1000" & @CRLF & _ "tweepy=3.8.0=py_0" & @CRLF & _ "urllib3=1.25.3=py36_0" & @CRLF & _ "wasabi=0.2.2=py_0" & @CRLF & _ "wcwidth=0.1.7=py_1" & @CRLF & _ "webencodings=0.5.1=py_1" & @CRLF & _ "werkzeug=0.15.5=py_0" & @CRLF & _ "wheel=0.33.4=py36_0" & @CRLF & _ "xz=5.2.4=h1de35cc_1001" & @CRLF & _ "zeromq=4.3.2=h6de7cb9_2" & @CRLF & _ "zlib=1.2.11=h01d97ff_1005" & @CRLF & _ "zstd=1.4.0=ha9f0a20_0" 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