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
/
\b(?:(t)hru|rough)\b
/
gi
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
Non-capturing group
(?:(t)hru|rough)
1st Alternative
(t)hru
1st Capturing Group
(t)
t matches the character t with index 11610 (7416 or 1648) literally (case insensitive)
hru
matches the characters hru literally (case insensitive)
2nd Alternative
rough
rough
matches the characters rough literally (case insensitive)
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
Global pattern flags
g modifier: global. All matches (don't return after first match)
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
Your regular expression does not match the subject string.

Regular Expression
No Match

/
/
gi

Test String

Substitution

Processing...

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 Perl, please visit: http://perldoc.perl.org/perlre.html