javascript - Equivalent word boundary regex for unicode characters -


this question has answer here:

i'm trying match given word (in case, in greek). word boundary \b won't work here, have this:

/(?:[\s;.,!?:-_]?)(αυτοκίνητο)(?:[\s.,!?:-_]|$)/gi 

the problem still match here:

aaa ααυτοκίνητο aaaa (notice repeated α)

if remove optional ?, not match:

αυτοκίνητο aaaa

any suggestions?

demo

(?:^|(?:[ ;.,!?:-_]))(αυτοκίνητο)(?:[\s.,!?:-_]|$) 

you need remove ? first group.see demo.

https://regex101.com/r/ss2dm8/2


Comments