Regular Expressions 101

Save & Share

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

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "(?m)^.*?\((.*)\).*$" Local $sString = " claudiu.cismaru (Claudiu Cismaru) SPEAKER" & @CRLF & _ " radu.mihailas (Radu Mihăilă) SPEAKER" & @CRLF & _ " alex_macau (Alex Macau) SPEAKER" & @CRLF & _ " angela.milas (Angela Palcu) SPEAKER" & @CRLF & _ " andrada.rupacici (Andrada Rupacici) SPEAKER" & @CRLF & _ " gary_star (Gabi Gidei) SPEAKER" & @CRLF & _ " mihai.moje (Mihai Moje) ADMIN" & @CRLF & _ " paul.ciocmareanu (Paul Adrian Ciocmareanu) SPEAKER" & @CRLF & _ " ionut.marghidanu (Ionut Marghidanu) SPEAKER" & @CRLF & _ " eduard.hirsch (Eduard Hirsch) SPEAKER" & @CRLF & _ " simonabelintan (Simona Bitu) SPEAKER" & @CRLF & _ " ade.scutca (Adela Scutca) SPEAKER" & @CRLF & _ " roibu-florin (Florin Roibu) SPEAKER" & @CRLF & _ " live:oanamariavlad (Oana Poenar (Vlad)) SPEAKER" & @CRLF & _ " live:andrei.trancota (Andrei Trancota) SPEAKER" & @CRLF & _ " live:ozy24us (Emanuel Craciun) SPEAKER" & @CRLF & _ " adrian.mosneagu23 (Adrian Mosneagu) SPEAKER" & @CRLF & _ " daniela.busu (Daniela Busu) SPEAKER" & @CRLF & _ " live:florin.turdasan (Florin Turdasan) SPEAKER" & @CRLF & _ " live:daniel.boita_1 (Daniel Boita) SPEAKER" & @CRLF & _ " denis.buliga (Denis Buliga) SPEAKER" & @CRLF & _ " live:jean.goujon_1 (Jean-Baptiste Goujon) SPEAKER" & @CRLF & _ " jurjandrei90 (Andrei Jurj) SPEAKER" & @CRLF & _ " i_pasca (Ioan Pasca) SPEAKER" & @CRLF & _ " claudiu0386 (Claudiu Mardarasevici) SPEAKER" & @CRLF & _ " didi.popoviciu (Didi Popoviciu) SPEAKER" & @CRLF & _ " anda.lele (Alexandra Lele) SPEAKER" & @CRLF & _ " lorand.varga (Lorand Varga) SPEAKER" & @CRLF & _ " live:412602f6b1e34602 (Mihaela Lemeni) SPEAKER" & @CRLF & _ " lvudesign (Liviu Iancu) SPEAKER" & @CRLF & _ " octavia_stancu (Ava Stancu) SPEAKER" & @CRLF & _ " live:422c271cb4bb230c (Beatrice Blidariu) SPEAKER" & @CRLF & _ " live:raresistoc1_1 (Rares Istoc) SPEAKER" & @CRLF & _ " live:octavia_octi30 (Octavia Bradea) SPEAKER" & @CRLF & _ " live:paula.dragoman (Paula Dragoman) SPEAKER" & @CRLF & _ " live:sanda.popoiu (Sanda Popoiu) ADMIN" & @CRLF & _ " live:aciu.alexandru (Alexandru Aciu) ADMIN" & @CRLF & _ " live:sirbu.sorin.cristian (Sorin Sirbu) SPEAKER" & @CRLF & _ " live:ana.tutuianu_1 (Ana Tutuianu) SPEAKER" & @CRLF & _ " narcis.oancea (narcis oancea) ADMIN" & @CRLF & _ " live:raresturc (Turc Rares) ADMIN" & @CRLF & _ " live:8922ae5e5ee0572e (Eduard Daniel Cocirla) SPEAKER" & @CRLF & _ " adelabalans (Adela Balan) ADMIN" & @CRLF & _ " tudor.vioreanu (Tudor Vioreanu) ADMIN" & @CRLF & _ " live:madalin.crestescu (Madalin Crestescu) SPEAKER" & @CRLF & _ " live:bokorb (Bokor Béla) SPEAKER" & @CRLF & _ " live:lavinia.a.stoia (Lavinia Stoia) ADMIN" & @CRLF & _ " timoce.ana (Ana Tutuianu) SPEAKER" & @CRLF & _ " live:ded6104985160d9b (Mircea Grigoras) SPEAKER" & @CRLF & _ " iancic.bogdan (Bogdan Iancic) SPEAKER" Local $sSubst = "$1" Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst) MsgBox($MB_SYSTEMMODAL, "Result", $sResult)

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