Regular Expressions 101

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8

Function

  • Match
  • Substitution
  • List
  • Unit Tests
/
^(?<time>(?:\d{2}:){2}\d{2}\.\d{3} [^\s]*) : (?<message2>[^ \]]*)\] (?<message3>[^ \]]*)\] (?<message4>[^ \]]*)\] (?<message5>[^ \]]*)\] (?<severity>\w+)\s+(?<log2222>.*)
/
g
^ asserts position at start of the string
Named Capture Group time
(?<time>(?:\d{2}:){2}\d{2}\.\d{3} [^\s]*)
Non-capturing group
(?:\d{2}:){2}
{2} matches the previous token exactly 2 times
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
\d
matches a digit (equivalent to [0-9])
{3} matches the previous token exactly 3 times
matches the character with index 3210 (2016 or 408) literally (case sensitive)
Match a single character not present in the list below
[^\s]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
:
matches the characters : literally (case sensitive)
Named Capture Group message2
(?<message2>[^ \]]*)
Match a single character not present in the list below
[^ \]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
Named Capture Group message3
(?<message3>[^ \]]*)
Match a single character not present in the list below
[^ \]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
Named Capture Group message4
(?<message4>[^ \]]*)
Match a single character not present in the list below
[^ \]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
Named Capture Group message5
(?<message5>[^ \]]*)
Match a single character not present in the list below
[^ \]]
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
\] matches the character ] with index 9310 (5D16 or 1358) literally (case sensitive)
matches the character with index 3210 (2016 or 408) literally (case sensitive)
Named Capture Group severity
(?<severity>\w+)
\w
matches any word character (equivalent to [a-zA-Z0-9_])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v ])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
Named Capture Group log2222
(?<log2222>.*)
.
matches any character (except for line terminators)
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
g

Test String

Code Generator

Generated Code

Loading code sample...
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