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

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 = "(?ms)##Player Stats\n(.*?)##Goalie Stats" Local $sString = "[](#startinjuredreserve)" & @CRLF & _ "" & @CRLF & _ "##Injured Reserve" & @CRLF & _ "|Position|Player|Salary|" & @CRLF & _ "|:-|:-|:-|" & @CRLF & _ "|RD|Oscar Fantenberg|$850,000|" & @CRLF & _ "|LW|Antoine Roussel|$3,000,000|" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "[](#endinjuredreserve)" & @CRLF & _ "" & @CRLF & _ "[](#startmagicalbotarea)" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "##Schedule" & @CRLF & _ "|Date|Time|Opponent|TV/Score|" & @CRLF & _ "|::|::|::|::|" & @CRLF & _ "|15 Oct|19:00|vs [Detroit Red Wings](/r/detroitredwings "Detroit Red Wings")|**W 5-1**|" & @CRLF & _ "|17 Oct|17:00|@ [St. Louis Blues](/r/stlouisblues "St. Louis Blues")|**W 4-3**|" & @CRLF & _ "|19 Oct|10:00|@ [New Jersey Devils](/r/devils "New Jersey Devils")|L 1-0|" & @CRLF & _ "|**Today**|10:00|@ [New York Rangers](/r/rangers "New York Rangers")|**W 3-2**|" & @CRLF & _ "|22 Oct|16:30|@ [Detroit Red Wings](/r/detroitredwings "Detroit Red Wings")|SN360|" & @CRLF & _ "|25 Oct|19:00|vs [Washington Capitals](/r/caps "Washington Capitals")|SN1|" & @CRLF & _ "|28 Oct|19:00|vs [Florida Panthers](/r/floridapanthers "Florida Panthers")|SNP|" & @CRLF & _ "" & @CRLF & _ "##Pacific Standings" & @CRLF & _ "|Team|GP|W|L|OTL|PTS|Streak" & @CRLF & _ "|::|::|::|::|::|::|::|" & @CRLF & _ "|[Edmonton Oilers](/r/edmontonoilers "Edmonton Oilers")|8|7|1|0|14|W2|" & @CRLF & _ "|[Anaheim Ducks](/r/anaheimducks "Anaheim Ducks")|8|6|2|0|12|W2|" & @CRLF & _ "|[Vegas Golden Knights](/r/goldenknights "Vegas Golden Knights")|9|6|3|0|12|W2|" & @CRLF & _ "|[Vancouver Canucks](/r/canucks "Vancouver Canucks")|8|5|3|0|10|W1|" & @CRLF & _ "|[Arizona Coyotes](/r/coyotes "Arizona Coyotes")|7|4|2|1|9|W3|" & @CRLF & _ "|[Calgary Flames](/r/calgaryflames "Calgary Flames")|9|4|4|1|9|L1|" & @CRLF & _ "|[San Jose Sharks](/r/sanjosesharks "San Jose Sharks")|8|3|5|0|6|L1|" & @CRLF & _ "|[Los Angeles Kings](/r/losangeleskings "Los Angeles Kings")|8|3|5|0|6|W1|" & @CRLF & _ "" & @CRLF & _ "##Player Stats" & @CRLF & _ "Player|GP|G|A|P|+/-|PIM|" & @CRLF & _ "|:|::|::|::|::|::|::|" & @CRLF & _ "|Miller|8|4|4|**8**|5|4|" & @CRLF & _ "|Pettersson|8|2|6|**8**|4|0|" & @CRLF & _ "|Boeser|8|2|5|**7**|4|0|" & @CRLF & _ "|Edler|8|3|3|**6**|-1|10|" & @CRLF & _ "|Sutter|8|2|3|**5**|1|7|" & @CRLF & _ "|Pearson|8|2|2|**4**|-4|2|" & @CRLF & _ "|Tanev|8|1|3|**4**|1|0|" & @CRLF & _ "|Hughes|8|1|3|**4**|1|2|" & @CRLF & _ "|Horvat|8|2|1|**3**|0|2|" & @CRLF & _ "|Leivo|8|1|2|**3**|1|2|" & @CRLF & _ "" & @CRLF & _ "##Goalie Stats" & @CRLF & _ "|Goalie|GP|W|L|SV%|GAA|SO|" & @CRLF & _ "|:|::|::|::|::|::|::|" & @CRLF & _ "|Markstrom|5|3|2|0.932|2.19|0|" & @CRLF & _ "|Demko|3|2|1|0.943|1.64|0|" & @CRLF & _ "" & @CRLF & _ "*****" & @CRLF & _ "Updated at: 20 Oct 2019, 03:12 PM PST" & @CRLF & _ "*****" & @CRLF & _ "" & @CRLF & _ "[](#endmagicalbotarea)" & @CRLF & _ "" & @CRLF & _ "##Filter Options" & @CRLF & _ "- If you want to block a certain type of posts, click one of the link filters below" & @CRLF & _ "" & @CRLF & _ "- [No Shitpost/Memes](https://nm.reddit.com/r/canucks/#nm)" & @CRLF & _ "" & @CRLF & _ "- [No Fan Content](https://nf.reddit.com/r/canucks/#nf)" & @CRLF & _ "" & @CRLF & _ "- [No Memes or Fan Content](https://mf.reddit.com/r/canucks/#mf)" & @CRLF & _ "" & @CRLF & _ "- [Reset Filter](https://reddit.com/r/canucks/)" & @CRLF & _ "" & @CRLF & _ "## Links & Resources" & @CRLF & _ "" & @CRLF & _ "- /r/hockey" & @CRLF & _ "- /r/UticaComets" & @CRLF & _ "- /r/TheAthleticVAN " & @CRLF & _ "- [Canucks Capfriendly](https://www.capfriendly.com/teams/canucks)" & @CRLF & _ "- [Canucks.com](https://www.nhl.com/canucks)" & @CRLF & _ "- [Canucks Official Twitter](https://twitter.com/canucks)" & @CRLF & _ "- [Canucks Official YT Channel](http://www.youtube.com/user/Canucks)" & @CRLF & _ "- [Sportsnet 650 Vancouver](http://www.sportsnet.ca/650/)" & @CRLF & _ "- [TSN 1040](http://www.tsn.ca/radio/vancouver-1040-i-1410)" & @CRLF & _ "- [**Join /r/Canucks Discord!**] (https://discord.gg/UTZ5Vrb)" & @CRLF & _ "" & @CRLF & _ "## Subreddit Wiki" & @CRLF & _ "" & @CRLF & _ "- [Rules and Guidelines](/r/canucks/wiki/rules)" & @CRLF & _ "- [Streaming Guide](/r/canucks/wiki/streaming)" & @CRLF & _ "- [Attending a Canucks Game?](/r/canucks/comments/2u5lxr/so_you_wanna_go_to_a_canucks_game_eh_faq_for/)" & @CRLF & _ "- [Canucks Resources](/r/canucks/wiki/resources)" & @CRLF & _ "- [Meme Hall of Fame](/r/canucks/wiki/memes)" & @CRLF & _ "- [AMA Archive](/r/canucks/wiki/amas)" & @CRLF & _ "- [**Nostalgia Corner**](https://www.reddit.com/r/canucks/wiki/nostalgia-corner)" 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