Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Save & Share

  • Save Regex
    ctrl+s
  • Update Regex
    ctrl+⇧+s

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python 2.7
  • 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)
1st Capturing Group
(t)
t matches the character t literally (case insensitive)
Non-capturing group
(?:hru|rough)
1st Alternative
hru
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...