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
No Match

r"
"
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)91.101.203.129.generic-hostname.arrownet.dk\StainedFilthyBareAvians.txt |" Local $sString = "##91.101.203.129.generic-hostname.arrownet.dk\StainedFilthyBareAvians.txt" & @CRLF & _ "## using this guide: https://asicseer.com/page/kb#writing-config" & @CRLF & _ "" & @CRLF & _ "global poolname1 sha.eobot.com:3333" & @CRLF & _ "global username1 eobot.1930455" & @CRLF & _ "global poolpass1 x" & @CRLF & _ "global sendworker1 yes" & @CRLF & _ "global poolname2 eu.blockmasters.co:3333" & @CRLF & _ "global username2 LeBekLf38PX2iWmRX1jJY3y9jjasV2eMLP" & @CRLF & _ "global poolpass2 c=LTC" & @CRLF & _ "global sendworker2 yes" & @CRLF & _ "global poolname3 coins.prohashing.com:3333" & @CRLF & _ "global username3 miningxxx" & @CRLF & _ "global poolpass3 c=Litecoin k=e9b3d7f181bd2369769867884cb12a575c946bd21c367b1f4b6858f5451506da" & @CRLF & _ "global sendworker3 yes" & @CRLF & _ "" & @CRLF & _ "global panelclear 5" & @CRLF & _ "global asicboost no" & @CRLF & _ "global autotune yes" & @CRLF & _ "global maxwatts 1480" & @CRLF & _ "global hpc 97" & @CRLF & _ "" & @CRLF & _ "global autoupdate yes" & @CRLF & _ "global allowed yes" & @CRLF & _ "global blinkgreen off" & @CRLF & _ "global blinkred off" & @CRLF & _ "" & @CRLF & _ "global maxtemp 90" & @CRLF & _ "global fansaver 55" & @CRLF & _ "global fanspeed 20" & @CRLF & _ "" & @CRLF & _ "global retune 1" & @CRLF & _ "global retune 2" & @CRLF & _ "global retune 3" & @CRLF & _ "global rebootasic 1" & @CRLF & _ "global rebootasic 2" & @CRLF & _ "global rebootasic 3" & @CRLF & _ "global resetasic 1" & @CRLF & _ "global resetasic 2" & @CRLF & _ "global resetasic 3" & @CRLF & _ "# global panelpass gj83Nkgikg" & @CRLF & _ "" & @CRLF & _ "group=rowc rebootasic 1" & @CRLF & _ "group=rowd allowed no" & @CRLF & _ "" & @CRLF & _ "# ab34ef location rowc2" & @CRLF & _ "" & @CRLF & _ "## vlans" & @CRLF & _ "vlan 10.0.3.0-255" & @CRLF & _ "vlan 10.0.4.0-255" & @CRLF & _ "vlan 10.0.5.0-255" & @CRLF & _ "vlan 10.0.6.0-255" & @CRLF & _ "vlan 10.0.7.0-255" & @CRLF & _ "" & @CRLF & _ "## asic password" & @CRLF & _ "asicpass admin" & @CRLF & _ "" & @CRLF & _ "0bfc61 [setting] [value] # 10.0.3.55 055 s-ago:1396 " & @CRLF & _ "174c32 [setting] [value] # 10.0.3.220 044 s-ago:1396 " & @CRLF & _ "0ca26a [setting] [value] # 10.0.3.45 045 s-ago:1428 " & @CRLF & _ "2a2e36 [setting] [value] # 10.0.3.210 046 s-ago:1457 " & @CRLF & _ "a2e9eb [setting] [value] # 10.0.3.215 047 s-ago:1457 " & @CRLF & _ "b9ef87 [setting] [value] # 10.0.3.50 050 s-ago:1462 " & @CRLF & _ "9b2c4f [setting] [value] # 10.0.3.49 049 s-ago:1473 " & @CRLF & _ "fa216b [setting] [value] # 10.0.3.030 230 s-ago:1477 " & @CRLF & _ "691c8e [setting] [value] # 10.0.3.70 224 s-ago:1586 " & @CRLF & _ "f75716 [setting] [value] # 10.0.3.44 244 s-ago:1591 " & @CRLF & _ "1866a4 [setting] [value] # 10.0.3.54 254 s-ago:1600 " & @CRLF & _ "c073b8 [setting] [value] # 10.0.3.219 025 s-ago:1602 " & @CRLF & _ "c6459d [setting] [value] # 10.0.3.225 225 s-ago:1605 " & @CRLF & _ "473676 [setting] [value] # 10.0.3.60 026 s-ago:1606 " & @CRLF & _ "a8315c [setting] [value] # 10.0.3.53 053 s-ago:1611 " & @CRLF & _ "e68e04 [setting] [value] # 10.0.3.218 027 s-ago:1614 " & @CRLF & _ "d27556 [setting] [value] # 10.0.3.59 017 s-ago:1616 " & @CRLF & _ "c2c141 [setting] [value] # 10.0.3.205 018 s-ago:1632 " & @CRLF & _ "80cbe7 [setting] [value] # 10.0.3.224 224 s-ago:1634 " & @CRLF & _ "2be5c0 [setting] [value] # 10.0.3.48 048 s-ago:1636 " & @CRLF & _ "1b667b [setting] [value] # 10.0.3.214 021 s-ago:1637 " & @CRLF & _ "3d05c9 [setting] [value] # 10.0.3.209 022 s-ago:1640 " & @CRLF & _ "351579 [setting] [value] # 10.0.3.228 228 s-ago:1642 " & @CRLF & _ "7508e2 [setting] [value] # 10.0.3.229 229 s-ago:1644 " & @CRLF & _ "0e3991 [setting] [value] # 10.0.3.52 052 s-ago:1647 " & @CRLF & _ "529b2e [setting] [value] # 10.0.3.64 026 s-ago:1651 " & @CRLF & _ "90a1ec [setting] [value] # 10.0.3.69 027 s-ago:1653 " & @CRLF & _ "dae87b [setting] [value] # 10.0.3.65 028 s-ago:1658 " & @CRLF & _ "656849 [setting] [value] # 10.0.3.213 029 s-ago:1760 " & @CRLF & _ "196fe8 [setting] [value] # 10.0.3.204 204 s-ago:1769 " & @CRLF & _ "d04421 [setting] [value] # 10.0.3.212 031 s-ago:1773 " & @CRLF & _ "96b709 [setting] [value] # 10.0.3.217 032 s-ago:1777 " & @CRLF & _ "40f1a4 [setting] [value] # 10.0.3.66 033 s-ago:1784 " & @CRLF & _ "27cad7 [setting] [value] # 10.0.3.51 051 s-ago:1788 " & @CRLF & _ "da321d [setting] [value] # 10.0.3.57 057 s-ago:1791 " & @CRLF & _ "619b76 [setting] [value] # 10.0.3.43 043 s-ago:1794 " & @CRLF & _ "acfec2 [setting] [value] # 10.0.3.58 058 s-ago:1802 " & @CRLF & _ "0c6d2f [setting] [value] # 10.0.3.63 138 s-ago:1802 " & @CRLF & _ "f1485a [setting] [value] # 10.0.3.207 239 s-ago:1804 " & @CRLF & _ "c44b94 [setting] [value] # 10.0.3.208 240 s-ago:1807 " & @CRLF & _ "227a2d [setting] [value] # 10.0.3.46 046 s-ago:1807 " & @CRLF & _ "cca2db [setting] [value] # 10.0.3.227 227 s-ago:1808 " & @CRLF & _ "60c3a2 [setting] [value] # 10.0.3.223 223 s-ago:1811 " & @CRLF & _ "781a92 [setting] [value] # 10.0.3.222 222 s-ago:1835 " & @CRLF & _ "ae5fa6 [setting] [value] # 10.0.3.203 145 s-ago:1837 " & @CRLF & _ "3c271f [setting] [value] # 10.0.3.67 146 s-ago:1839 " & @CRLF & _ "81beae [setting] [value] # 10.0.3.47 047 s-ago:1840 " & @CRLF & _ "882c88 [setting] [value] # 10.0.3.42 042 s-ago:1850 " & @CRLF & _ "f64b7b [setting] [value] # 10.0.3.221 221 s-ago:85504 " & @CRLF & _ "6a7f19 [setting] [value] # 10.0.3.41 041 s-ago:122108 " & @CRLF & _ "27ff38 [setting] [value] # 10.0.3.56 056 s-ago:118254 " & @CRLF & _ "70a371 [setting] [value] # 10.0.3.226 226 s-ago:108091 " 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