elanhickler

regex iterate through groups

Mar 10th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. regex regular_expression = "(.*?)_(.*?)_(.*?)";
  2. input_string = "3_4_5";
  3. match_results<std::string::const_iterator> iterator;
  4. regex_search(input_string, iterator, regular_expression);
  5. string entire_string = m[0];
  6. string group1 = m[1];
  7. string group2 = m[2];
  8. string group3 = m[3];
Advertisement
Add Comment
Please, Sign In to add comment