问题
Does it? If yes, where can I get the documentation for it... if not, then which would be the best alternative?
回答1:
C++11 now finally does have a standard regex library - std::regex.
If you do not have access to a C++11 implementation, a good alternative could be boost regex. It isn't completely equivalent to std::regex (e.g. the "empty()" method is not in the std::regex) but it's a very mature regex implementation for C++ none the less.
回答2:
Under UNIX-like systems you can use POSIX regex functions.
回答3:
The Microsoft Visual C++ 2008 Feature Pack 1 (now rolled into the Visual Studio 2008 Service Pack 1) contains a implementation of the 'official' TR1 reg ex types. Knock yourself out :-)
回答4:
Check the boost regex library. It should become part of the standard with C++0x.
回答5:
If by standard you mean bundled with compiler, then not. But most of the other languages that bundle regex extension use pretty standard c
implementations. E.g. PCRE - Perl Compatible Regular Expression and C libraries have POSIX regex support (see man page).
回答6:
Regular Expressions are part of the C++ extension TR1. Dinkumware, visual studio and others already have implemented this. See
Quick Start for C++ TR1 Regular Expressions
Visual C++ 2008 Feature Pack
回答7:
Qt, from Trolltech, also has a regex implementation which I find very easy to use. However, if you are not planning of using Qt for anything else I would use Boost.Regex as you probably would be good off using Boost for other purposes as well.
回答8:
The standard ISO/IEC 14882:2011 Programming Language C++ describes a regex class as part of C++'s library, which is heavily influenced by the mature Boost library.
Curiously, as of January 2013, compilers' compliance with this standard is still spotty, e.g. the GNU compiler suite's popular C++ compiler does not support/comply with this part of the standard.
For that reason, it's best to use Boost at this point in time until compiler support reaches compliance.
回答9:
+1 for PCRE - Perl Compatible Regular Expression , I remembered using Mircosoft's GRETA as well.
来源:https://stackoverflow.com/questions/1420546/does-c-or-c-have-a-standard-regex-library