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
/
(bb|[^b]{2})
/
1st Capturing Group
(bb|[^b]{2})
1st Alternative
bb
bb
matches the characters bb literally (case sensitive)
2nd Alternative
[^b]{2}
Match a single character not present in the list below
[^b]
{2} matches the previous token exactly 2 times
b matches the character b with index 9810 (6216 or 1428) literally (case sensitive)
Your regular expression does not match the subject string.

Regular Expression
No Match

/
/

Test String