Created
March 27, 2019 12:02
-
-
Save utilForever/2bb897942e0e632747c5cb5c2f7ff14a to your computer and use it in GitHub Desktop.
Regex test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is a "Hello, world!" in C++ language by GCC for wandbox. | |
#include <iostream> | |
#include <regex> | |
int main() | |
{ | |
std::regex attackRegex("\\+([[:digit:]]+) Attack"); | |
std::string text = "Raid Leader is granting this minion +1 Attack"; | |
std::smatch values; | |
if (std::regex_search(text, values, attackRegex)) | |
{ | |
std::cout << values[1].str().c_str() << '\n'; | |
} | |
else | |
{ | |
std::cout << "Not found\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment