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
/
(.*\.)?(.*\.)(rentmanager|lcs)(\.com|\.dev|\.qa)
/
gm
1st Capturing Group
(.*\.)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
.
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)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
2nd Capturing Group
(.*\.)
.
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)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
3rd Capturing Group
(rentmanager|lcs)
1st Alternative
rentmanager
rentmanager
matches the characters rentmanager literally (case sensitive)
2nd Alternative
lcs
lcs
matches the characters lcs literally (case sensitive)
4th Capturing Group
(\.com|\.dev|\.qa)
1st Alternative
\.com
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
com
matches the characters com literally (case sensitive)
2nd Alternative
\.dev
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
dev
matches the characters dev literally (case sensitive)
3rd Alternative
\.qa
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
qa
matches the characters qa 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