如何将连续的unicode与QRegExp匹配?
我检查了Qt的文档,它完全支持unicode与\xhhhh的匹配,但是这样我只能匹配已知的unicode,那么我如何识别unicode字符串呢?
谢谢 !
@update:
QString line;
if ( line.indexOf(QRegExp ("\\p{L}")) ) != -1 )
{
/// blabla
}
它不起作用,我没有看到流程进入 if
I checked Qt's doc , it fully support matching of unicode with \xhhhh , but in that way i can only match known unicodes , how can i recognize a unicode string then ?
Thanks !
@update:
QString line;
if ( line.indexOf(QRegExp ("\\p{L}")) ) != -1 )
{
/// blabla
}
It's not working , i didn't see the flow went inside the if
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道 Qt 正则表达式,但根据 doc
我认为它应该支持 Unicode 属性、脚本和块。有关详细概述,请参阅 www.regular-expressions.info。
例如,您可以使用属性字母
\p{L}
将 unicode 代码点与属性字母进行匹配。要匹配仅包含此类代码点的字符串,请使用类似以下内容I Don't know Qt regular expresions, but according to the doc
I would assume that it should then support Unicode Properties, Scripts and Blocks. For a detailed overview see www.regular-expressions.info.
You could e.g. use the property letter
\p{L}
to match a unicode codepoint with the property letter. To match a string consisting only of such code points use something like this