我想使用正则表达式,我看到POSIX正则表达式库提供函数,但我如何包括库?在哪里可以找到文件?我谷歌了很多,没有找到任何手册。谁能给我提供一个手册或一个手册的链接?我正在使用Visual Studio Code
C本身没有正则表达式,但有多个库提供此功能,如:
- PCRE和PCRE2 - http://www.pcre.org/ libgnurx - https://github.com/TimothyGu/libgnurx
- TRE - http://laurikari.net/tre/about/
- sregex - https://github.com/openresty/sregex
- slre - https://github.com/cesanta/slre
- liblightgrep - https://github.com/strozfriedberg/liblightgrep
- RxSpencer - https://github.com/garyhouston/rxspencer
- RE2 - https://github.com/google/re2/
- 黑影- https://github.com/kkos/oniguruma
- Onigmo - https://github.com/k-takata/Onigmo
- Hyperscan - https://www.hyperscan.io/
可能还有更多的正则表达式库。
我已经能够使用MinGW-w64从Windows的源代码编译上述所有内容。
最常用的是PCRE, PCRE2, libgnurx,但Oniguruma和hypercan是有趣的替代品。
如果你使用的是c++,还有std::regex或boost::regex