How to program the search for the first word in a string using a regular C ++ expression? A lot of revised information, but there is nothing sensible. The regular expression itself was written, but I don’t know how to make the search ...

1 answer 1

Hmm .. I came up with this way:

http://ideone.com/RESgso

 #include <iostream> #include <string> #include <regex> using namespace std; int main() { string str = "Just a string :)"; string res = regex_replace(str, regex("^\\W*(\\w+).*$"), "$1"); cout << res << endl; return 0; } 

And how to find exactly the entries, something is not googled: (