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@\\](t[xyq]|th(nx|nq|x)|than[xk](s)?(you|[syxzq]){0,1})\b
/
gi
Match a single character not present in the list below
[^`\w@\\]
` matches the character ` with index 9610 (6016 or 1408) literally (case insensitive)
\w matches any word character (equivalent to [a-zA-Z0-9_])
@ matches the character @ with index 6410 (4016 or 1008) literally (case insensitive)
\\ matches the character \ with index 9210 (5C16 or 1348) literally (case insensitive)
1st Capturing Group
(t[xyq]|th(nx|nq|x)|than[xk](s)?(you|[syxzq]){0,1})
1st Alternative
t[xyq]
t matches the character t with index 11610 (7416 or 1648) literally (case insensitive)
Match a single character present in the list below
[xyq]
xyq
matches a single character in the list xyq (case insensitive)
2nd Alternative
th(nx|nq|x)
th
matches the characters th literally (case insensitive)
2nd Capturing Group
(nx|nq|x)
1st Alternative
nx
nx
matches the characters nx literally (case insensitive)
2nd Alternative
nq
nq
matches the characters nq literally (case insensitive)
3rd Alternative
x
x matches the character x with index 12010 (7816 or 1708) literally (case insensitive)
3rd Alternative
than[xk](s)?(you|[syxzq]){0,1}
than
matches the characters than literally (case insensitive)
Match a single character present in the list below
[xk]
xk
matches a single character in the list xk (case insensitive)
3rd Capturing Group
(s)?
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
s matches the character s with index 11510 (7316 or 1638) literally (case insensitive)
4th Capturing Group
(you|[syxzq]){0,1}
{0,1} matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
1st Alternative
you
you
matches the characters you literally (case insensitive)
2nd Alternative
[syxzq]
Match a single character present in the list below
[syxzq]
syxzq
matches a single character in the list syxzq (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...