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

/
/
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)1" Local $sString = "Telephone,Date,Zip" & @CRLF & _ "1-917-887-9281,08/02/2015,61022" & @CRLF & _ "1-614-122-0700,07/12/2013,51642" & @CRLF & _ "1-401-310-3354,04/07/2015,86161" & @CRLF & _ "1-776-738-7726,01/12/2014,61294" & @CRLF & _ "1-512-994-9175,02/02/2014,89104" & @CRLF & _ "1-401-546-6134,12/01/2014,89820" & @CRLF & _ "1-168-498-8484,21/06/2015,49526" & @CRLF & _ "1-778-253-5497,14/01/2015,98123" & @CRLF & _ "1-404-432-9739,10/09/2014,74122" & @CRLF & _ "1-629-563-3288,26/10/2013,47379" & @CRLF & _ "1-399-794-0834,21/05/2015,69891" & @CRLF & _ "1-210-801-0619,18/06/2015,79134" & @CRLF & _ "1-789-756-2201,10/07/2014,34644" & @CRLF & _ "1-673-598-4221,23/06/2015,89506" & @CRLF & _ "1-898-944-9344,02/05/2014,78701" & @CRLF & _ "1-401-926-2823,16/11/2014,38679" & @CRLF & _ "1-673-176-5233,03/09/2014,83277" & @CRLF & _ "1-670-119-0983,13/12/2013,44606" & @CRLF & _ "1-929-431-8036,21/06/2015,76118" & @CRLF & _ "1-941-986-2478,02/04/2014,38809" & @CRLF & _ "1-965-311-5298,13/02/2015,67390" & @CRLF & _ "1-966-241-2160,19/10/2014,12024" & @CRLF & _ "1-171-218-2878,16/05/2014,89757" & @CRLF & _ "1-579-696-3951,07/05/2015,88783" & @CRLF & _ "1-880-379-8249,27/05/2014,84169" & @CRLF & _ "1-729-730-5787,25/11/2014,50579" & @CRLF & _ "1-401-281-4234,28/01/2014,67149" & @CRLF & _ "1-136-687-0372,01/01/2015,88760" & @CRLF & _ "1-324-552-7773,06/12/2013,96232" & @CRLF & _ "1-460-954-6974,09/10/2014,44191" & @CRLF & _ "1-401-535-7233,17/12/2013,15725" & @CRLF & _ "1-177-661-0599,11/08/2015,58068" & @CRLF & _ "1-958-872-4163,14/02/2014,65903" & @CRLF & _ "1-751-976-1258,19/09/2015,33419" & @CRLF & _ "1-970-750-5604,08/03/2015,49727" & @CRLF & _ "1-401-311-1655,21/06/2015,16233" & @CRLF & _ "1-368-460-0652,14/04/2015,46683" & @CRLF & _ "1-561-904-8040,05/11/2013,84159" & @CRLF & _ "1-434-990-8299,19/01/2014,99741" & @CRLF & _ "1-405-919-6493,19/03/2014,92955" & @CRLF & _ "1-273-356-8382,03/03/2015,94595" & @CRLF & _ "1-969-466-0391,02/06/2014,28607" & @CRLF & _ "1-365-885-5483,09/07/2015,72921" & @CRLF & _ "1-479-782-0491,08/09/2015,90440" & @CRLF & _ "1-337-274-2635,09/01/2014,90487" & @CRLF & _ "1-126-912-0604,29/06/2015,77501" & @CRLF & _ "1-528-770-1186,16/10/2014,12597" & @CRLF & _ "1-251-239-7048,10/11/2013,56237" & @CRLF & _ "1-754-230-8264,16/11/2014,35546" & @CRLF & _ "1-257-642-5660,25/10/2014,86283" & @CRLF & _ "1-633-547-7089,26/04/2015,30792" & @CRLF & _ "1-161-604-0959,28/01/2015,83378" & @CRLF & _ "1-497-635-0092,26/07/2015,95635" & @CRLF & _ "1-926-635-0188,15/04/2014,95133" & @CRLF & _ "1-288-287-3450,08/06/2014,21739" & @CRLF & _ "1-981-694-3820,16/12/2014,12878" & @CRLF & _ "1-727-533-4754,23/05/2015,66255" & @CRLF & _ "1-310-697-1783,01/03/2014,94502" & @CRLF & _ "1-401-356-8358,10/11/2013,17172" & @CRLF & _ "1-264-760-2541,27/10/2014,61896" & @CRLF & _ "1-462-318-2842,14/12/2014,86195" 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