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
"
(?i)\b(nigg(a|er)|asshole|crap|fag|fuck(ing)?|idiot|shit|whore)s\b
"
g
(?i)
match the remainder of the pattern with the following effective flags: gi
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])
\b assert position at a word boundary: (^\w|\w$|\W\w|\w\W)
1st Capturing Group
(nigg(a|er)|asshole|crap|fag|fuck(ing)?|idiot|shit|whore)
1st Alternative
nigg(a|er)
nig matches the characters nig literally (case insensitive)
g
matches the character g literally (case insensitive)
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
2nd Capturing Group
(a|er)
1st Alternative
a
a matches the character a literally (case insensitive)
2nd Alternative
er
er matches the characters er literally (case insensitive)
2nd Alternative
asshole
asshole matches the characters asshole literally (case insensitive)
3rd Alternative
crap
crap matches the characters crap literally (case insensitive)
4th Alternative
fag
fag matches the characters fag literally (case insensitive)
5th Alternative
fuck(ing)?
fuck matches the characters fuck literally (case insensitive)
3rd Capturing Group
(ing)?
6th Alternative
idiot
idiot matches the characters idiot literally (case insensitive)
7th Alternative
shit
8th Alternative
whore
s
matches the character s literally (case insensitive)
? matches the previous token between zero and one times, as many times as possible, giving back as needed (greedy)
\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)
Your regular expression does not match the subject string.

Regular Expression
No Match

r"
"
g

Test String