Regular Expressions 101

Save & Share

  • Save Regex
  • Update Regex


  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8


  • Match
  • Substitution
  • List
  • Unit Tests
1st Capturing Group
1st Alternative
^ asserts position at start of the string
2nd Alternative
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
3rd Alternative
> matches the character > with index 6210 (3E16 or 768) literally (case sensitive)
# matches the character # with index 3510 (2316 or 438) literally (case sensitive)
2nd Capturing Group
Match a single character not present in the list below
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
matches a single character in the list <> (case sensitive)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
Global pattern flags
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


Test String