Could someone explain the differences between the two? Which would be better to learn right now? How would knowledge transfer from one to the other and vice-versa?
-
6Learning the standard way is never a bad thing.Mark Ransom– Mark Ransom2011-09-28 21:37:53 +00:00Commented Sep 28, 2011 at 21:37
-
4Be careful with the Standard Library C++11 Regex, because it is still not fully implemented by GCC: stackoverflow.com/questions/4716680/c0x-regex-in-gccMihai Todor– Mihai Todor2012-08-01 22:26:21 +00:00Commented Aug 1, 2012 at 22:26
3 Answers
The boost regex library made it into C++0x so I'm guessing it will slowly be removed from boost. However, using boost is nice because you can still use it with compilers without C++0x support. So it's really up to you.
3 Comments
s/boost::/std::/g ?One major difference is, that C++11 does not provide the Perl syntax for regular expressions. So, if you tend to use Perl syntax you have to use the Boost::Regex library.
9 Comments
perl as equivalent to ECMAScript boost.org/doc/libs/1_53_0/libs/regex/doc/html/boost_regex/ref/….ECMAScript regex are the same?At least in Visual Studio 2013 this and related names (cmatch, regex_match) are the same in both namespaces. They also have the same (or similar?) interface.
So you can just change namespace and the same code will be compiled with another regex without warning and errors. And it should work the same of course.
P.S. I would prefer std::regex since it is part of C++11 and boost::regex is a third-party library. I'm sure few years later, boost will remove support for boost::regex.