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
`
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 (except for line terminators)
matches the character with index 1010 (A16 or 128) literally (case sensitive)
. matches any character (except for line terminators)
x matches the character x with index 12010 (7816 or 1708) literally (case sensitive)

Regular Expression

`
`

Unit Tests

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