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"
"
gm

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\s./-]*(?:\s\d+){4}(?:\s\$\d+\.\d+){2}$" Local $sString = "Amount" & @CRLF & _ "2144-PL" & @CRLF & _ "1XL 2XL 3XL" & @CRLF & _ "2144-" & @CRLF & _ "PL Navy Blue 2 2 2 6 $11.50 $69.00" & @CRLF & _ "ETK-2097K-PL PLUS-TOP - BACK BUTTON TUNICS 95% RAYON 5% SPANDEX MADE IN USA" & @CRLF & _ "1XL 2XL 3XL" & @CRLF & _ "Black 2 2 2 6 $12.00 $72.00" & @CRLF & _ "Teal 2 2 2 6 $12.00 $72.00" & @CRLF & _ "ETK-2197-SW-" & @CRLF & _ "1XL 2XL 3XL" & @CRLF & _ "PL ETK-" & @CRLF & _ "2197- H.Grey/Burgu… 2 2 2 6 $14.00 $84.00" & @CRLF & _ "Off-White/Black 1 1 1 3 $14.00 $42.00" & @CRLF & _ "ETK-2143 Tops - 95% RAYON 5% SPANDEX MADE IN USA" & @CRLF & _ "S M L" & @CRLF & _ "Heather Grey 2 2 2 6 $10.50 $63.00" & @CRLF & _ "Royal Blue 2 2 2 6 $10.50 $63.00" & @CRLF & _ "Ruby Red 2 2 2 6 $10.50 $63.00" & @CRLF & _ "ETK2186-GD- Tops-Stripe Solid-95% Rayon 5% Spandex Made in USA" & @CRLF & _ "PL" & @CRLF & _ "1XL 2XL 3XL" & @CRLF & _ "Burgundy/Bur… 2 2 2 6 $11.00 $66.00" & @CRLF & _ "Ivory/Black 2 2 2 6 $11.00 $66.00" & @CRLF & _ "2139 - WP-PL PLUS TOP -95% RAYON 5% SPANDEX MADE IN USA" & @CRLF & _ "1XL 2XL 3XL" & @CRLF & _ "As Shown 2 2 2 6 $9.50 $57.00" & @CRLF & _ "ETK-2228" & @CRLF & _ "S M L" & @CRLF & _ "ETK- " & @CRLF & _ "2228 Off-White/Black 2 2 2 6 $9.50 $57.00" & @CRLF & _ "ETK-2149-PL" & @CRLF & _ "1XL 2XL 3XL" & @CRLF & _ "ETK-" & @CRLF & _ "2149- Taupe 2 2 2 6 $11.50 $69.00" & @CRLF & _ "BACK" & @CRLF & _ "ORDERED" & @CRLF & _ "White 2 2 2 6 $11.50 $69.00" & @CRLF & _ "Sub" 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