Boost.Regex vs C++11 Regex

匆匆过客 提交于 2019-12-03 23:32:34

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!