Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
r"
\b(?:omg|oh([ -])my\1god)\b
"
gm
Input 1
1
New
My goal is to go over a text file and count the amount of time the phrase 'oh my god' is written. the phrase can appear in different ways like:'omg' 'oh-my-god', 'oh my god!'... I've tried this pattern but I miss some and it doesn't count all of them:
Substitution
My goal is to go over a text file and count the amount of time the phrase 'oh my god' is written. the phrase can appear in different ways like:'omg' 'oh-my-god', 'oh my god!'... I've tried this pattern but I miss some and it doesn't count all of them: