Does it? If yes, where can I get the documentation for it... if not, then which would be the best alternative?
-
Near-duplicates: http://stackoverflow.com/questions/181624, http://stackoverflow.com/questions/923500 and http://stackoverflow.com/questions/815429. – Peter Mortensen Sep 14 '09 at 10:31
-
1http://stackoverflow.com/questions/329517/there-is-a-function-to-use-pattern-matching-using-regular-expressions-in-c – dmckee --- ex-moderator kitten Sep 14 '09 at 21:15
-
1BTW: you could have had a wealth of information faster and easier by searching: http://stackoverflow.com/search?q=c+c%2B%2B+regex+standard – dmckee --- ex-moderator kitten Sep 14 '09 at 21:17
9 Answers
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.

- 1
- 1

- 10,814
- 2
- 49
- 75
-
This answer is dated, as of 2012 the answer is now Yes, C++ has a standard regex library, mandated by C++11, under the header "regex" – Anne Quinn Aug 03 '12 at 01:39
-
@Clairvoire - I've decided to edit / update my answer to the changes since late 2009, thanks for the heads-up on this outdated answer. – Joris Timmermans Aug 03 '12 at 07:13
-
The difference is also the c++ standard does not support named subgroups, that is naming parts of regular expressions so that later you can get them by name. – user3111311 Jan 23 '14 at 12:57
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 :-)

- 171
- 2
Check the boost regex library. It should become part of the standard with C++0x.

- 55,237
- 33
- 144
- 193
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).

- 138,757
- 24
- 193
- 173
Regular Expressions are part of the C++ extension TR1. Dinkumware, visual studio and others already have implemented this. See

- 12,032
- 10
- 54
- 92
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.

- 83
- 1
- 5
+1 for PCRE - Perl Compatible Regular Expression , I remembered using Mircosoft's GRETA as well.

- 2,718
- 5
- 28
- 38