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
"
([a-zA-Z^ ]+?)(\d+?|at)\s+([a-zA-Z^ ]+?)(\d+)?\s+?(\(.+\))\s*?
"
g
1st Capturing Group
([a-zA-Z^ ]+?)
Match a single character present in the list below
[a-zA-Z^ ]
+? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
a-z matches a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
^
matches a single character in the list ^ (case sensitive)
2nd Capturing Group
(\d+?|at)
1st Alternative
\d+?
\d
matches a digit (equivalent to [0-9])
+? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
2nd Alternative
at
at
matches the characters at literally (case sensitive)
\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)
3rd Capturing Group
([a-zA-Z^ ]+?)
Match a single character present in the list below
[a-zA-Z^ ]
+? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
a-z matches a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
^
matches a single character in the list ^ (case sensitive)
4th Capturing Group
(\d+)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\d
matches a digit (equivalent to [0-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 few times as possible, expanding as needed (lazy)
5th Capturing Group
(\(.+\))
\( matches the character ( with index 4010 (2816 or 508) literally (case sensitive)
.
matches any character (except for line terminators)
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\) matches the character ) with index 4110 (2916 or 518) literally (case sensitive)
\s
matches any whitespace character (equivalent to [\r\n\t\f\v  ])
*? matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy)
Global pattern flags
g modifier: global. All matches (don't return after first match)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"
g

Test String