开发者

PHP's preg_match() equivalent in C++?

开发者 https://www.devze.com 2022-12-23 22:02 出处:网络
My question is simple. Is there a PHP\'s preg_match() function equivalent in the C++ STL? If not, can you tell me an alternat开发者_开发百科ive?

My question is simple. Is there a PHP's preg_match() function equivalent in the C++ STL?

If not, can you tell me an alternat开发者_开发百科ive?

Thanks.


STL (till C++0x) does not supports regular expressions. But you can use boost::regex library.


preg_match() calls code from libPCRE. If you want the equivalent of preg_match(), then you must use that library.

Alternatively, if you just need the feature of regular expression matching (PCRE or not), there is also the Boost::regex library mentioned in another answer.

If your compiler supports the new versions of the standard (C++11 or later), then it probably also includes the new standard regular expression library. The Standard includes support for ECMAScript syntax (which is very similar to, and based on, PCRE) as well as a few others.

0

精彩评论

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

关注公众号