Debian Codegraph @

yo/stl/examples/regexreplace2.cc

raw
1 #include <string>
2 #include <iostream>
3 #include <regex>
4 #include <iterator>
5
6 using namespace std;
7
8 int main()
9 {
10 //start
11 regex re("([[:alpha:]]+)\\s+(\\d+)"); // letters blanks digits
12
13 string target("this value 1024 is interesting");
14
15 regex_replace(ostream_iterator<char>(cout, ""), target.begin(),
16 target.end(), re, "$2"s);
17 //=
18 cout << '\n';
19 }