Regular Expressions 101

Save & Share

Flavor

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

Function

  • Match
  • Substitution
  • List
  • Unit Tests
"
(RSTART_(?=(([A-Z0-9]{6}[0-9]))))|(NO_SIGNAL)
"
mg
1st Alternative
(RSTART_(?=(([A-Z0-9]{6}[0-9]))))
1st Capturing Group
(RSTART_(?=(([A-Z0-9]{6}[0-9]))))
RSTART_
matches the characters RSTART_ literally (case sensitive)
Positive Lookahead
(?=(([A-Z0-9]{6}[0-9])))
Assert that the Regex below matches
2nd Capturing Group
(([A-Z0-9]{6}[0-9]))
3rd Capturing Group
([A-Z0-9]{6}[0-9])
Match a single character present in the list below
[A-Z0-9]
{6} matches the previous token exactly 6 times
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
Match a single character present in the list below
[0-9]
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
2nd Alternative
(NO_SIGNAL)
4th Capturing Group
(NO_SIGNAL)
NO_SIGNAL
matches the characters NO_SIGNAL literally (case sensitive)
Global pattern flags
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
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"
"
mg

Test String