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]
  • 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 = "(?m)^(?!^.*\[)(?=\w+).*" Local $sString = "[Event "Wch U16"]" & @CRLF & _ "[Site "Wattignies"]" & @CRLF & _ "[Date "1976.??.??"]" & @CRLF & _ "[Round "?"]" & @CRLF & _ "[White "Dunne, David Joseph"]" & @CRLF & _ "[Black "Kasparov, Gary"]" & @CRLF & _ "[Result "0-1"]" & @CRLF & _ "[WhiteElo ""]" & @CRLF & _ "[BlackElo ""]" & @CRLF & _ "[ECO "B51"]" & @CRLF & _ "" & @CRLF & _ "1. e2e4 c7c5 2. g1f3 d7d6 3. f1b5+ b8d7 4. d2d4 g8f6 5. b1c3 c5d4 6. d1d4" & @CRLF & _ "e7e5 7. d4d3 h7h6 8. c1e3 f8e7 9. e1g1 e8g8 10. a1d1 a7a6 11. b5c4 d8c7 12." & @CRLF & _ "a2a4 d7c5 13. e3c5 c7c5 14. c3d5 f6d5 15. c4d5 a8b8 16. f3d2 c8d7 17. d5b3" & @CRLF & _ "b7b5 18. a4a5 b8c8 19. d2f3 d7e6 20. f1e1 f8d8 21. e1e2 c8c7 22. e2d2 d8c8" & @CRLF & _ "23. h2h3 c5b4 24. b3e6 f7e6 25. d3b3 c7c4 26. d2e2 b4b3 27. c2b3 c4c1 28." & @CRLF & _ "d1c1 c8c1+ 29. g1h2 g8f7 30. f3e1 e7d8 31. e1d3 c1d1 32. d3b4 d8a5 33. b4a6" & @CRLF & _ "d1c1 34. b3b4 a5b6 35. b2b3 c1c3 36. e2a2 c3b3 37. a2c2 b6d4 38. c2c7+ f7f6" & @CRLF & _ "39. f2f3 b3a3 40. c7c6 a3c3 41. c6c7 c3c7 42. a6c7 d4c3 43. c7b5 c3b4 44." & @CRLF & _ "b5a7 f6f7 45. h2g3 f7e8 46. g3g4 e8d7 47. f3f4 g7g6 48. h3h4 d7c7 49. f4f5" & @CRLF & _ "e6f5+ 50. e4f5 g6f5+ 51. g4f5 c7b7 52. a7b5 b7b6 53. b5d6 b4d6 54. g2g4" & @CRLF & _ "b6c6 55. g4g5 h6g5 56. h4g5 c6d5 57. g5g6 d6f8 0-1" 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