Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
regex select, find
#include <iostream> #include <regex> using namespace std; int main() { string s = "<rule source=\"192.168.10.10:any\" destination=\"any:any\" protocol=\"UDP\"/>"; const regex r(".*\"(.*)\" destination.*"); smatch sm; string result; if (regex_search(s, sm, r)) result = sm[1]; cout << result << endl; // result = "192.168.10.10:any" return 0; }
run
|
edit
|
history
|
help
0
Project
Not an overflow
dhar1
ToString library for C++
Even Odd
virtual test
MSVC ignoring unknown attributes
Removing __unaligned specifier partial solution
#22.1
Copy initialization: overload resolution issue