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)(?:[hanks]{4,5}|hx|anx)\b
/
gi
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
1st Capturing Group
(t)
t matches the character t with index 11610 (7416 or 1648) literally (case insensitive)
Non-capturing group
(?:[hanks]{4,5}|hx|anx)
1st Alternative
[hanks]{4,5}
Match a single character present in the list below
[hanks]
{4,5} matches the previous token between 4 and 5 times, as many times as possible, giving back as needed (greedy)
hanks
matches a single character in the list hanks (case insensitive)
2nd Alternative
hx
hx
matches the characters hx literally (case insensitive)
3rd Alternative
anx
anx
matches the characters anx 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...