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
/
^.+?(?=[\s\.\,\:\;])pression(?=[\s\.\,\:\;]).+$
/
i
^ asserts position at start of the string
.
matches any character (except for line terminators)
+? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
Positive Lookahead
(?=[\s\.\,\:\;])
Assert that the Regex below matches
Match a single character present in the list below
[\s\.\,\:\;]
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
\. matches the character . with index 4610 (2E16 or 568) literally (case insensitive)
\, matches the character , with index 4410 (2C16 or 548) literally (case insensitive)
\: matches the character : with index 5810 (3A16 or 728) literally (case insensitive)
\; matches the character ; with index 5910 (3B16 or 738) literally (case insensitive)
pression
matches the characters pression literally (case insensitive)
Positive Lookahead
(?=[\s\.\,\:\;])
Assert that the Regex below matches
Match a single character present in the list below
[\s\.\,\:\;]
\s matches any whitespace character (equivalent to [\r\n\t\f\v ])
\. matches the character . with index 4610 (2E16 or 568) literally (case insensitive)
\, matches the character , with index 4410 (2C16 or 548) literally (case insensitive)
\: matches the character : with index 5810 (3A16 or 728) literally (case insensitive)
\; matches the character ; with index 5910 (3B16 or 738) literally (case insensitive)
.
matches any character (except for line terminators)
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
$ 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
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
i

Test String