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
/
w|[ehmors]e|[^u]es|duc|[dn]y
/
gm
1st Alternative
w
w matches the character w with index 11910 (7716 or 1678) literally (case sensitive)
2nd Alternative
[ehmors]e
Match a single character present in the list below
[ehmors]
ehmors
matches a single character in the list ehmors (case sensitive)
e matches the character e with index 10110 (6516 or 1458) literally (case sensitive)
3rd Alternative
[^u]es
Match a single character not present in the list below
[^u]
u matches the character u with index 11710 (7516 or 1658) literally (case sensitive)
es
matches the characters es literally (case sensitive)
4th Alternative
duc
duc
matches the characters duc literally (case sensitive)
5th Alternative
[dn]y
Match a single character present in the list below
[dn]
dn
matches a single character in the list dn (case sensitive)
y matches the character y with index 12110 (7916 or 1718) literally (case sensitive)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
Your regular expression does not match the subject string.Try launching the debugger to find out why.

Regular Expression
No Match

/
/
gm

Test String

Code Generator

Generated Code

Loading code sample...
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report.
For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php