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"
(?i)(?<!\S)(<unk>)(?!\S)|[^\w\s]+
"
gm
Input 1
New
text = "the asbestos fiber <unk> <unk| is < unusually <unk once it enters the <<unk>$% with " text = "the asbestos fiber <UNK> <unk| is < unusually <unk once it enters the <<unk>$% with "
Substitution
\1
text = "the asbestos fiber <unk> <unk| is < unusually <unk once it enters the <<unk>$% with " text = "the asbestos fiber <UNK> <unk| is < unusually <unk once it enters the <<unk>$% with "