Word boundaries are not taken in account if the letter near the word boundary is accentuated:
"aé ae".match(new RegExp("é\\b", 'igu')); // null
"aé ae".match(new RegExp("e\\b", 'igu')); // ["e"]
How could I make it work?
Three requirements:
- I need to use the RegExp constructor (as the word to match is variable)
- It's not envisageable to replace all accents
- The solution needs to work on both sides:
\bword\b