Why does the letter é
count as a word boundary matching \b
in the following example?
Pattern: /\b(cum)\b/i
Text: écumé
Matches 'cum' which is not desired.
Is it possible to overcome this?
It will work, when you add the u
modifier to your regex
/\b(cum)\b/iu
To deal with unicode, replace \b
with
/(?<=^|\PL)(cum)(?=\PL|$)/i