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
No Match

r"
"

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 = "(?<=application: label=')(.+?)(?=')" Local $sString = "package: name='com.ghisler.android.TotalCommander' versionCode='160' versionName='2.72' platformBuildVersionName='6.0-2166767'" & @CRLF & _ "install-location:'auto'" & @CRLF & _ "sdkVersion:'3'" & @CRLF & _ "targetSdkVersion:'23'" & @CRLF & _ "uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'" & @CRLF & _ "uses-permission: name='android.permission.BLUETOOTH_ADMIN'" & @CRLF & _ "uses-permission: name='android.permission.BLUETOOTH'" & @CRLF & _ "uses-permission: name='android.permission.INTERNET'" & @CRLF & _ "uses-permission: name='android.permission.ACCESS_NETWORK_STATE'" & @CRLF & _ "uses-permission: name='android.permission.WAKE_LOCK'" & @CRLF & _ "uses-permission: name='android.permission.ACCESS_SUPERUSER'" & @CRLF & _ "uses-permission: name='com.android.launcher.permission.INSTALL_SHORTCUT'" & @CRLF & _ "uses-permission: name='com.ghisler.tcplugins.restricted'" & @CRLF & _ "application-label:'Total Commander'" & @CRLF & _ "application-icon-120:'res/drawable-ldpi-v4/icon.png'" & @CRLF & _ "application-icon-160:'res/drawable-v11/icon.png'" & @CRLF & _ "application-icon-240:'res/drawable-hdpi-v11/icon.png'" & @CRLF & _ "application-icon-320:'res/drawable-xhdpi-v11/icon.png'" & @CRLF & _ "application-icon-480:'res/drawable-xxhdpi-v11/icon.png'" & @CRLF & _ "application-icon-640:'res/drawable-xxhdpi-v11/icon.png'" & @CRLF & _ "application: label='Total Commander' icon='res/drawable-v11/icon.png'" & @CRLF & _ "launchable-activity: name='com.ghisler.android.TotalCommander.TotalCommander' label='Total Commander' icon=''" & @CRLF & _ "leanback-launchable-activity: name='com.ghisler.android.TotalCommander.TotalCommander' label='Total Commander' icon='' banner=''" & @CRLF & _ "uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'" & @CRLF & _ "uses-implied-permission: name='android.permission.READ_EXTERNAL_STORAGE' reason='requested WRITE_EXTERNAL_STORAGE'" & @CRLF & _ "feature-group: label=''" & @CRLF & _ " uses-feature-not-required: name='android.hardware.bluetooth'" & @CRLF & _ " uses-feature-not-required: name='android.hardware.touchscreen'" & @CRLF & _ "main" & @CRLF & _ "other-activities" & @CRLF & _ "other-receivers" & @CRLF & _ "other-services" & @CRLF & _ "supports-screens: 'small' 'normal' 'large' 'xlarge'" & @CRLF & _ "supports-any-density: 'true'" & @CRLF & _ "locales: '--_--' 'da' 'ja' 'id' 'be' 'de' 'he' 'bg' 'vi' 'sk' 'uk' 'el' 'nl' 'pl' 'sl' 'ko' 'ro' 'fr' 'hr' 'sr' 'tr' 'cs' 'es' 'it' 'lt' 'hu' 'ru' 'sv' 'iw' 'zh-CN' 'pt-BR' 'pt-PT' 'zh-TW'" & @CRLF & _ "densities: '120' '160' '240' '320' '480' '640'" & @CRLF & _ "native-code: 'armeabi' 'mips' 'x86'" & @CRLF & _ "" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH) ; 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