Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
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]
  • Character class intersection
    [\w&&[^\d]]
  • 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
Processing...

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 = "(^|[^\{])(\{\{((\#invoke\:\s*)?([\w\s\:\/\-\+\.\'\"\\]+?))\s*((?:\s*\|(?:[^\|\{\}]*(?:\{\{[^\{\}]*(?:\{[^\{\}]*\{\{[^\{\}]*(?:\{(?:\{\{(?:\{[^\{\}]+\}|[^\{\}]+)\}\}[^\{\}]*)\}|(?:\{\{(?:\{[^\{\}]+\}|[^\{\}]+)\}\}[^\{\}]*))?\}\}\}[^\{\}]*|\{\{[^\{\}]*(?:\{(?:\{\{(?:\{[^\{\}]+\}|[^\{\}]+)\}\}[^\{\}]*)\}|(?:\{\{(?:\{[^\{\}]+\}|[^\{\}]+)\}\}[^\{\}]*))?\}\}[^\{\}]*)?\}\}[^\{\}]*|\{\{\{[^\{\}]*(?:\{\{(?:\{[^\{\}]+\}|[^\{\}]+)\}\}[^\{\}]*)?\}\}\}[^\{\}]*)?))*)\}\})" Local $sString = "{{DISPLAYTITLE:Stats}}" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "====<span style="font-size:1.5em;">Example</span>====" & @CRLF & _ "'''Calculate ''Attack Power'' for Standard Guerilla Helmet at level 65''' <small>(its max level)</small>" & @CRLF & _ "{{#invoke:Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Standard Guerilla Helmet|taco {{{foo}}} bar|get=iconbordersmalllevel%small%bgimage%level%max|foo={{#if:bar|a={{{stuff|a={{bell}}}}}}}|taco=bell}}<br>" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "{{UprisingPageFooter" & @CRLF & _ "|" & @CRLF & _ "fo|" & @CRLF & _ "|taco=bell}}" & @CRLF & _ "" & @CRLF & _ "<onlyinclude>{{#invoke:UprisingEquipmentInfobox2" & @CRLF & _ "|get={{{get|infobox}}}" & @CRLF & _ "|arg1={{{arg1|}}}" & @CRLF & _ "|arg2={{{arg2|}}}" & @CRLF & _ "|arg3={{{arg3|}}}" & @CRLF & _ "|image=Uprising_Icon_Item_Base_M_Backpack_00061_C.png" & @CRLF & _ "|name=Altered Bounty Hunter Pack" & @CRLF & _ "|description=Defensive gear used by the Ivax Syndicate." & @CRLF & _ "|tier=2" & @CRLF & _ "|baseStarLevel=3" & @CRLF & _ "|evolution=1" & @CRLF & _ "|stars=4" & @CRLF & _ "|maxstarcount=6" & @CRLF & _ "|type=backpack" & @CRLF & _ "|location=Bespin" & @CRLF & _ "|gearSetName=Altered Bounty Hunter" & @CRLF & _ "|gearSetBaseName=Bounty Hunter" & @CRLF & _ "|gearSetDisplayName=Altered Bounty Hunter" & @CRLF & _ "|gearSetPrefix=Altered" & @CRLF & _ "|faction=Ivax Syndicate" & @CRLF & _ "|gearType=Defensive" & @CRLF & _ "|baseLevel=65" & @CRLF & _ "|levelCap=90" & @CRLF & _ "|navNext=Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Revised_Bounty_Hunter_Pack/T2" & @CRLF & _ "|navPrev=Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Stock_Bounty_Hunter_Pack/T2" & @CRLF & _ "|baseStat=250" & @CRLF & _ "|attack=28.5%" & @CRLF & _ "|attackMin=584" & @CRLF & _ "|attackBase=1471" & @CRLF & _ "|attackMax=2565" & @CRLF & _ "|armor=14.5%" & @CRLF & _ "|armorMin=297" & @CRLF & _ "|armorBase=748" & @CRLF & _ "|armorMax=1305" & @CRLF & _ "|utility=57%" & @CRLF & _ "|utilityMin=1166" & @CRLF & _ "|utilityBase=2941" & @CRLF & _ "|utilityMax=5130" & @CRLF & _ "|mod1Name=Control" & @CRLF & _ "|mod1Value=+4%" & @CRLF & _ "|mod2Name=Attack Speed" & @CRLF & _ "|mod2Value=+3.5%" & @CRLF & _ "|mod3Name=Accuracy" & @CRLF & _ "|mod3Value=+2.5%" & @CRLF & _ "|upgradeComponent1Name=Faceted Carbonite" & @CRLF & _ "|upgradeComponent1Type=Carbonite" & @CRLF & _ "|upgradeComponent1Prefix=Faceted" & @CRLF & _ "|upgradeComponent1Count=3" & @CRLF & _ "|upgradeComponent2Name=Faceted Chunah" & @CRLF & _ "|upgradeComponent2Type=Chunah" & @CRLF & _ "|upgradeComponent2Prefix=Faceted" & @CRLF & _ "|upgradeComponent2Count=3" & @CRLF & _ "|upgradeCost=192000" & @CRLF & _ "|sellPriceMin=21600" & @CRLF & _ "|sellPriceMax=64800" & @CRLF & _ "}}</onlyinclude>" & @CRLF & _ "" & @CRLF & _ "The '''&quot;Altered Bounty Hunter Pack&quot;''' is a piece of '''Tier 2''' armor, equippable to the ''Backpack'' slot, that appears in [[Star Wars: Uprising]]. It's a member of the ''&quot;{{#ifexist:Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/GearSets/Altered Bounty Hunter|[[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/GearSets/Altered Bounty Hunter|Altered Bounty Hunter]]|{{#ifexist:Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/GearSets/Bounty Hunter|[[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/GearSets/Bounty Hunter|Altered Bounty Hunter]]|Altered Bounty Hunter}}}}&quot;'' armor set and has been upgraded 1 time <small>(E1)</small>." & @CRLF & _ "" & @CRLF & _ "==Information==" & @CRLF & _ "; Known Location(s):" & @CRLF & _ ": Bespin" & @CRLF & _ "" & @CRLF & _ "; General Equation:" & @CRLF & _ ": <pre>ceiling(max((92.30769231*PowerUpLevel+4000),(320*(PowerUpLevel-65)+10000))*ScalarValue)</pre>" & @CRLF & _ "" & @CRLF & _ "<!--" & @CRLF & _ "General information, and location(s) where the item can be seen/acquired " & @CRLF & _ "-->" & @CRLF & _ "" & @CRLF & _ "==Gallery==" & @CRLF & _ "<gallery>" & @CRLF & _ "Uprising_Icon_Item_Base_M_Backpack_00061_C.png" & @CRLF & _ "Uprising_Icon_Item_Base_F_Backpack_00061_C.png" & @CRLF & _ "</gallery>" & @CRLF & _ "<!--" & @CRLF & _ "If available, show male/female versions in gallery" & @CRLF & _ "-->" & @CRLF & _ "" & @CRLF & _ "==Related==" & @CRLF & _ "; Variations" & @CRLF & _ ": [[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Revised_Bounty_Hunter_Pack/T2|Revised Bounty Hunter Pack]]&nbsp;<small>(Upgrades To)</small>" & @CRLF & _ ": [[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Stock_Bounty_Hunter_Pack/T2|Stock Bounty Hunter Pack]]&nbsp;<small>(Upgraded From)</small>" & @CRLF & _ "" & @CRLF & _ "; Altered Bounty Hunter Set" & @CRLF & _ ": [[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Altered_Bounty_Hunter_Gloves/T2|Altered Bounty Hunter Gloves]]&nbsp;<small>(T2,E1)</small>" & @CRLF & _ ": [[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Altered_Bounty_Hunter_Helmet/T2|Altered Bounty Hunter Helmet]]&nbsp;<small>(T2,E1)</small>" & @CRLF & _ ": [[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Altered_Bounty_Hunter_Jacket/T2|Altered Bounty Hunter Jacket]]&nbsp;<small>(T2,E1)</small>" & @CRLF & _ ": [[Wookieepedia:Star_Wars:_Uprising_Super_Walkthrough/Equipment/Altered_Bounty_Hunter_Fatigues/T2|Altered Bounty Hunter Fatigues]]&nbsp;<small>(T2,E1)</small>" & @CRLF & _ "<!--" & @CRLF & _ "Items directly related to this one. Like previous/next upgraded versions and items with similar attributes." & @CRLF & _ "-->" & @CRLF & _ "" & @CRLF & _ "{{UprisingPageFooter}}" & @CRLF & _ "" 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