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
/
^http(s):\/\/(www\.google.com|google\.com|88n8\.com|second\.88n8\.com|third\.88n8\.com|fourth\.88n8\.com)$
/
gm
^ asserts position at start of a line
http
matches the characters http literally (case sensitive)
1st Capturing Group
(s)
s matches the character s with index 11510 (7316 or 1638) literally (case sensitive)
: matches the character : with index 5810 (3A16 or 728) literally (case sensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
\/ matches the character / with index 4710 (2F16 or 578) literally (case sensitive)
2nd Capturing Group
(www\.google.com|google\.com|88n8\.com|second\.88n8\.com|third\.88n8\.com|fourth\.88n8\.com)
1st Alternative
www\.google.com
www
matches the characters www literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
google
matches the characters google literally (case sensitive)
. matches any character (except for line terminators)
com
matches the characters com literally (case sensitive)
2nd Alternative
google\.com
google
matches the characters google literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
com
matches the characters com literally (case sensitive)
3rd Alternative
88n8\.com
88n8
matches the characters 88n8 literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
com
matches the characters com literally (case sensitive)
4th Alternative
second\.88n8\.com
second
matches the characters second literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
88n8
matches the characters 88n8 literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
com
matches the characters com literally (case sensitive)
5th Alternative
third\.88n8\.com
third
matches the characters third literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
88n8
matches the characters 88n8 literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
com
matches the characters com literally (case sensitive)
6th Alternative
fourth\.88n8\.com
fourth
matches the characters fourth literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
88n8
matches the characters 88n8 literally (case sensitive)
\. matches the character . with index 4610 (2E16 or 568) literally (case sensitive)
com
matches the characters com literally (case sensitive)
$ asserts position at the end of a line
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

Substitution

Processing...