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?
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.
s/boost::/std::/g
? –
Marcellamarcelle 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.
perl
as equivalent to ECMAScript
boost.org/doc/libs/1_53_0/libs/regex/doc/html/boost_regex/ref/…. –
Jeanett ECMAScript
regex are the same? –
Nighthawk std::regex
doesn't? Or does too? –
Bole std::regex
does not. –
Jeanett 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.
© 2022 - 2024 — McMap. All rights reserved.