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 (17)
/
^(?!.*x(| |. .)x)
/
s
^ asserts position at start of the string
Negative Lookahead
(?!.*x(| |. .)x)
Assert that the Regex below does not match
.
matches any character
* matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
x matches the character x with index 12010 (7816 or 1708) literally (case sensitive)
1st Capturing Group
(| |. .)
1st Alternative null, matches any position
2nd Alternative
matches the character with index 1010 (A16 or 128) literally (case sensitive)
3rd Alternative
. .
. matches any character
matches the character with index 1010 (A16 or 128) literally (case sensitive)
. matches any character
x matches the character x with index 12010 (7816 or 1708) literally (case sensitive)
Global pattern flags
s modifier: single line. Dot matches newline characters (draft)

Regular Expression

/
/
s

Unit Tests

given the string x. .x assert that regex does not match
given the string .. xx .. assert that regex does not match
given the string x. xx .x assert that regex does not match
given the string .. .x xx .x .. assert that regex does not match
given the string x. x. xx .. assert that regex does not match
given the string .. .x xx x. .x .. .. assert that regex does not match
given the string x. x. x. .. x. .x .. .x .. assert that regex does not match
given the string .. .. .. .. .x xx x. xx .x .x assert that regex does not match
given the string .. assert that regex does match
given the string x. .. assert that regex does match
given the string .. .x assert that regex does match
given the string .. .. .. assert that regex does match
given the string x. .. .x assert that regex does match
given the string .. .. x. .. assert that regex does match
given the string .. .x .. x. .. .x .. x. .. assert that regex does match
given the string x. x. .. .x .x .. .. x. x. .. .x assert that regex does match
additional unsolvable maze test case