\w 将来会等同于 \p{L} 吗?
我不明白为什么使用 /u
修饰符 \w
不起作用,我们必须更改我们的正则表达式。更不用说\b
了。
所以有人知道在新版本(也许是 php 6?)上 \w
是否会与 \p{L}
和 /u
相同?
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
\w
因语言环境而异,因此,在某些情况下不捕获奇怪的符文或象形文字实际上很方便,而只支持在所需语言环境中被视为单词字符的字符。\w
&\p{L}
在功能上完全不同。配置区域设置是人们应该更加了解的。使用适合该工作的正确工具,而不是用大锤来敲击 1 英寸的钉子,将\w
替换为\p{L}
即可。如果他们真的改变了很多现有的功能就会被破坏。而且,这与 PHP unicode 兼容的持续努力完全无关。\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.