Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. std::smatch match;
  2. std::string B = "B";
  3. std::array<std::regex,2> regex = {
  4.     std::regex("(A)"),
  5.     std::regex("(B)")
  6. };
  7. for(auto it = regex.begin(); it != regex.end(); ++it)
  8.     if(std::regex_match(B, match, *it) && match.size() > 0)
  9.         std::cout << match.str(1) << std::endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement