I have a simple question.
How would i check if my string equals another string if that string has changing numbers at the end.
Random:1
Random (1):1
Random (2):1
Random (3):1
Random (4):1
So on...
and also with a string like this
Random
Random_1
Random_2
Random_3
Random_4
So on...
>Solution :
You need std::regex_match and std::regex from <regex>:
#include <regex>
bool match(const char* cstr)
{
static auto re = std::regex("Random \\([0-9]*\\):1"); // or whatever regex you'd like
return std::regex_match(cstr, re);
}