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
/
([a-zA-Z0-9])\1{5}\1+
/
ug
1st Capturing Group
([a-zA-Z0-9])
Match a single character present in the list below
[a-zA-Z0-9]
a-z matches a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z matches a single character in the range between A (index 65) and Z (index 90) (case sensitive)
0-9 matches a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
\1
matches the same text as most recently matched by the 1st capturing group
{5} matches the previous token exactly 5 times
\1
matches the same text as most recently matched by the 1st capturing group
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
Global pattern flags
u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters
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

/
/
ug

Test String

Substitution

Processing...