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
/
(\+41)\s(\d{2})\s(\d{3})\s(\d{2})\s(\d{2})
/
1st Capturing Group
(\+41)
\+ matches the character + with index 4310 (2B16 or 538) literally (case sensitive)
41
matches the characters 41 literally (case sensitive)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
2nd Capturing Group
(\d{2})
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
3rd Capturing Group
(\d{3})
\d
matches a digit (equivalent to [0-9])
{3} matches the previous token exactly 3 times
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
4th Capturing Group
(\d{2})
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
5th Capturing Group
(\d{2})
\d
matches a digit (equivalent to [0-9])
{2} matches the previous token exactly 2 times
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/

Test String

Regex Debugger

Please wait while your expression is being debugged...