javascript - Equivalent word boundary regex for unicode characters -
this question has answer here:
- utf-8 word boundary regex in javascript 5 answers
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?
(?:^|(?:[ ;.,!?:-_]))(αυτοκίνητο)(?:[\s.,!?:-_]|$)
you need remove ?
first group.see demo.
Comments
Post a Comment