Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

\w will become equivalent to \p{L} in a future?

I don't understand why with /u modifier \w doesn't work, and we have to change our regex. Not to talk about \b.

So anyone know if on a new version (maybe php 6?) \w will become the same as \p{L} with /u ?

Thanks

like image 276
dynamic Avatar asked Feb 11 '12 16:02

dynamic


1 Answers

\w differs with locales, and as such, it is actually handy NOT to capture strange runes or hieroglyphs in some cases, in favor of only characters considered word characters in the desired locale. \w & \p{L} are functionally totally different. Configuring locales is what people should be more aware of. Use the right tool for the job, and not a sledgehammer to hammer a 1-inch nail, which substituting \w for \p{L} would be. A lot of existing functionality would break if they did change it. Also, this is entirely unrelated to the ongoing effort of making PHP unicode compatible.

like image 99
Wrikken Avatar answered Oct 03 '22 22:10

Wrikken