Talk:cpp/regex/regex replace
From cppreference.com
There is a problem with std::regex_replace, it does not compile as expected. No idea why...
-- Johan
- If you are referring to the example on this page, it can be compiled with those compilers/libraries that implemented
<regex>, such as clang++/libc++ (from 2009 or newer) and Visual Studio (2010 or newer). GNU g++/libstdc++ only got to it in version 4.9. --Cubbi (talk) 06:06, 2 December 2013 (PST)
example regex_replace
#include <regex> #include <string> #include <iostream> int main(void) { std::cout<<std::regex_replace("abcdefghiabcdefghi",std::regex("def",std::regex::extended),"CODE") <<" should have CODE twice in the string." <<std::endl; return 0; }
you can put this in for an example for folks to use. 50.188.152.148 05:29, 9 November 2016 (PST)