I wanna make a regular expression to find specific word allowing special characters(\W
). For example, if the word is replace
then:
replace
matched.replace(
,$replace
,replace
,replace
matched because of allowing special characters.areplace
,replacea
not matched because ofa
.
It seems like I have to use (?=)
operator, but I have no idea about how to use it.