Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how can I replace a pattern from string in c++

#include <string>
#include <regex>

std::string test = "abc def abc def";
test = std::regex_replace(test, std::regex("def"), "klm"); // replace 'def' -> 'klm'
// test = "abc klm abc klm"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #I #replace #pattern #string
ADD COMMENT
Topic
Name
5+7 =