PHP's preg_match() equivalent in C++?
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.
精彩评论