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
/
((.)((?<=(?= ((?<=(?=$.|\2|(?4)).))|(?3)).)))*$
/
s
matches the character with index 1010 (A16 or 128) literally (case sensitive)
1st Capturing Group
((.)((?<=(?= ((?<=(?=$.|\2|(?4)).))|(?3)).)))*
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
2nd Capturing Group
(.)
. matches any character
3rd Capturing Group
((?<=(?= ((?<=(?=$.|\2|(?4)).))|(?3)).))
Positive Lookbehind
(?<=(?= ((?<=(?=$.|\2|(?4)).))|(?3)).)
Assert that the Regex below matches
Positive Lookahead
(?= ((?<=(?=$.|\2|(?4)).))|(?3))
Assert that the Regex below matches
1st Alternative
((?<=(?=$.|\2|(?4)).))
matches the character with index 1010 (A16 or 128) literally (case sensitive)
4th Capturing Group
((?<=(?=$.|\2|(?4)).))
Positive Lookbehind
(?<=(?=$.|\2|(?4)).)
Assert that the Regex below matches
Positive Lookahead
(?=$.|\2|(?4))
Assert that the Regex below matches
1st Alternative
$.
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
. matches any character
2nd Alternative
\2
\2 matches the same text as most recently matched by the 2nd capturing group
3rd Alternative
(?4)
(?4) recurses the 4th subpattern
. matches any character
2nd Alternative
(?3)
(?3) recurses the 3rd subpattern
. matches any character
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Global pattern flags
s modifier: single line. Dot matches newline characters
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
s

Test String