Search
 
SCRIPT & CODE EXAMPLE
 

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"
Comment

PREVIOUS NEXT
Code Example
Cpp :: landscape overleaf 
Cpp :: fast io c++ 
Cpp :: xmake set binary name 
Cpp :: how to get a word from file c++ 
Cpp :: __lg(x) in c++ 
Cpp :: finding no of unique characters in a string c++ 
Cpp :: recursive binary search 
Cpp :: how to make a 2d vector in c++ 
Cpp :: quotation in c++ string 
Cpp :: Matrix multiply using function c++ 
Cpp :: point is on line 
Cpp :: Sort array using inbuilt sort function in decreasing order 
Cpp :: sfml mouse button pressed 
Cpp :: compare float values c++ 
Cpp :: format string cpp 
Cpp :: getch c++ library 
Cpp :: c++ code for selection sort 
Cpp :: read file into vector 
Cpp :: how to compare lower case character to uppercase cpp 
Cpp :: 2d vector cpp 
Cpp :: sort vector in descending order 
Cpp :: sin in c++ 
Cpp :: c++ nested switch statements 
Cpp :: read text from file c++ 
Cpp :: c++ if in equivalent 
Cpp :: check uppercase c++ 
Cpp :: c++ get ascii value of char 
Cpp :: the code execution cannot proceed because glew32.dll was not found 
Cpp :: pop_back 
Cpp :: naive pattern matching algorithm 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =