Regular Expressions 101

Save & Share

  • Regex Version: ver. 5
  • 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

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "(?m)<TEXT>\s*begin \d+ (?>[^e]+|e(?!nd\s*<\/TEXT>))*end\s*<\/TEXT>" Local $sString = "<HTML>" & @CRLF & _ " <BODY STYLE="font: 10pt Times New Roman, Times, Serif">" & @CRLF & _ "<TEXT>" & @CRLF & _ "begin 644 h52992h5299202.gif" & @CRLF & _ "M1TE&.#EA>P`>`,0``']_?S\_/^_O[P\/#[^_OU]?7Q\?'X^/CY^?GZ^OK\_/" & @CRLF & _ "MSV]O;T]/3]_?WR\O+U!04````/___P``````````````````````````````" & @CRLF & _ "M`````````````````````````"'Y!```````+`````![`!X```7_8"2.9&F>" & @CRLF & _ "M:*JN+"DP22O/=&W?Z`(M>.__0-4`T@@:C\A689=L-0B$!`(!`""@S:P)$M"B" & @CRLF & _ "M!(#"$$(NEP,`0E,AR!X@"N_I`1D$&-6JM,H8PXX-$`5-`@9=<B8(#'$K5$,'" & @CRLF & _ "M1H$0:D@,$#&(*PD`*0(.<$8!@D@*$`:9*P)D*@D0G$&?"$A+KZ@H;PPJ;[4^" & @CRLF & _ "MI09M1Z)%MBB6E"<(ID8&9,!!`G;$7T-?2P[./F]DLD8`$)`F"@0'",->;X<E" & @CRLF & _ "M")\,V#W0`T.\/IX#YA$"8F2BEW)+/",:(!#EX!@0'0!:S>OQ!F"$!&+L%(C#" & @CRLF & _ "MS($<4<#`5#S@SD:#`@#:&#A%P%6W22):_QG@J(`/&7`N`#@`U[+`J0A4`-P[" & @CRLF & _ "M`0V"B`,&!A2`^>.%F5\*@S08*4+!$`,`%HS9$4/``2MAIA:P=(;?O@0=?T*P" & @CRLF & _ "M&&%;DP1>XT%H]P/MO@!3S;P-P$RNF0$+$+3:!X!!7:@=EV`BXQ!)L@()I)*Q" & @CRLF & _ "MPTT&@@(!O)K"<X``5[D.%E2YDN!O90+F7I(8N)C1"&%BQQ:X$@P"L%:11[5`" & @CRLF & _ "M4%=NX8!0")@N`8:MB0*W11#X-("7@W3XELBU$SER8QFETI5<F$(!,Z$<(WB[" & @CRLF & _ "M*2W"1Z(F31#(`[DYLT$T1)F>?AIYB5)<G*D:8+`["?8T"(3M%&U$4A%1I:#-" & @CRLF & _ "M??%09Y]V*/5`VU0*WF`B@@X.KN"4(%!X0]^!*'A37PT*$'6")?(-L9,*$Y8Q" & @CRLF & _ "MP&X8DJ##B$DL04(IZ,U``&0&%+!?BH9D$D4)V:68A"KN^2BD#R4%-^21-O2(" & @CRLF & _ "'Y)(TA```.S\_" & @CRLF & _ "`" & @CRLF & _ "end" & @CRLF & _ "</TEXT>" & @CRLF & _ " <TEXT>losses occurring in the third quarter and from weather </TEXT>" & @CRLF & _ " </BODY>" Local $sSubst = "<TEXT><\/TEXT>" 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