开发者

Qt/C++ regular expression library with unicode property support

开发者 https://www.devze.com 2022-12-29 21:39 出处:网络
I\'m converting an application from the .Net framework to Qt using C++. The application makes extensive use of regular expression unicode properties, i.e. \\p{L}, \\p{M}, etc. I\'ve just discovered th

I'm converting an application from the .Net framework to Qt using C++. The application makes extensive use of regular expression unicode properties, i.e. \p{L}, \p{M}, etc. I've just discovered that the QRegExp class lacks support for this among other things (lookbehinds, etc.)

Can anyone recommend a C++ regular expression library that:

  • Supports unicode properties
  • Is unicode-aware in other respects (i.e. \w matches more than ASCII word characters)
  • As a bonus, supports lookbehinds.

Please don't point me to the wikipedia article; I don't trust it. That article says that QRegExp supports unicode properties. Unless I'm really doing something wrong, it doesn't. I'm looking for som开发者_运维技巧eone actually using unicode properties with a regex library in a project.


http://site.icu-project.org/

ICU is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications.

  • released under a nonrestrictive open source license
  • ...
  • Regular Expression: ICU's regular expressions fully support Unicode while providing very competitive performance.

It's also compatible to Boost, see their statement in this regard.


There should be nothing stopping you from using PCRE (http://www.pcre.org/), though converting back and forth from QStrings to const char *s could be a pain/performance hit.

0

精彩评论

暂无评论...
验证码 换一张
取 消