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
/
(\W|\s|\d|\w|\S)([7, 8][0-9]{10})
/
mg
1st Capturing Group
(\W|\s|\d|\w|\S)
1st Alternative
\W
\W matches any non-word character (equivalent to [^a-zA-Z0-9_])
2nd Alternative
\s
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
3rd Alternative
\d
\d matches a digit (equivalent to [0-9])
4th Alternative
\w
\w matches any word character (equivalent to [a-zA-Z0-9_])
5th Alternative
\S
\S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ])
2nd Capturing Group
([7, 8][0-9]{10})
Match a single character present in the list below
[7, 8]
7, 8
matches a single character in the list 7, 8 (case sensitive)
Match a single character present in the list below
[0-9]
{10} matches the previous token exactly 10 times
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (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.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
mg

Test String

Substitution

Processing...

Regex Debugger

Please wait while your expression is being debugged...