-
Notifications
You must be signed in to change notification settings - Fork 0
Different Browsers Handle Regex Differently
Daisho Komiyama edited this page Jan 14, 2018
·
2 revisions
Hi, I've just found a weird behaviour about handling regular expressions.
This world's most popular browser takes French accents (e.g. é, à, û) as word characters therefore \w
matches é
, à
or û
.
However other browser such as Firefox and Safari, they takes French accents as nonword characters therefore \w
won't match é
, à
neither û
.
If you want to write match pattern safely, you will have to be explicit for French accents i.e. write pattern this way a-zàâäèéêëîïôœùûüÿç
to match French accents. So don't count on Chrome too much as this browser is sometimes too nice to be used for development. This browser is really hardworking and it covers minor errors without complaining.