utf-8 word boundary regex in javascript
Posted
by cherouvim
on Stack Overflow
See other posts from Stack Overflow
or by cherouvim
Published on 2010-05-21T11:01:52Z
Indexed on
2010/05/21
11:10 UTC
Read the original article
Hit count: 284
In JavaScript:
"ab abc cab ab ab".replace(/\bab\b/g, "AB");
correctly gives me:
"AB abc cab AB AB"
When I use utf-8 characters though:
"aß aß? ?aß aß aß".replace(/\baß\b/g, "AB");
the word boundary operator doesn't seem to work:
"aß aß? ?aß aß aß"
Is there a solution to this?
© Stack Overflow or respective owner