gpt4 book ai didi

regex - 关于 Unicode 正则表达式词边界中的\b{w} 语法

转载 作者:行者123 更新时间:2023-12-04 02:09:16 25 4
gpt4 key购买 nike

RL2.2UTS #18 describe the syntax \b{w} for Extended Grapheme Clusters of Word Boundary in Unicode regular expression ,但我不太明白它与 \b 语法的区别。在 UTS #18 , 它说

\b{w}. A Unicode word boundary. Note that this is different than \b alone, which corresponds to \w and \W. See Annex C: Compatibility Properties.

那么这两种语法到底有什么区别呢?

最佳答案

\b == \w\W

\W = [^A-Za-z0-9_] => 它只处理 asci 字母数字,而 \b{w} 处理 UNICODE 字符集 (即:更宽的字母数字集)。

你可以看到 an emulation of \b{w} here 的例子与 usual behavior 相比.

关于regex - 关于 Unicode 正则表达式词边界中的\b{w} 语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40280160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com