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
/
che(ck|qu)(er|ing|r|e)?[^s]
/
gm
che
matches the characters che literally (case sensitive)
1st Capturing Group
(ck|qu)
1st Alternative
ck
ck
matches the characters ck literally (case sensitive)
2nd Alternative
qu
qu
matches the characters qu literally (case sensitive)
2nd Capturing Group
(er|ing|r|e)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
1st Alternative
er
er
matches the characters er literally (case sensitive)
2nd Alternative
ing
ing
matches the characters ing literally (case sensitive)
3rd Alternative
r
r matches the character r with index 11410 (7216 or 1628) literally (case sensitive)
4th Alternative
e
e matches the character e with index 10110 (6516 or 1458) literally (case sensitive)
Match a single character not present in the list below
[^s]
s matches the character s with index 11510 (7316 or 1638) literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gm

Test String