regexp-search added, std lib loader changes, more REadme items
This commit is contained in:
@@ -12,3 +12,21 @@ void replace_substring(std::string &src, const std::string &substr, const std::s
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns true if where contains regex
|
||||
bool regexp_search(const std::string &where, const std::string ®ex_str) {
|
||||
// online tester https://www.regextester.com/97722
|
||||
std::regex regex(regex_str);
|
||||
std::smatch match;
|
||||
|
||||
if(std::regex_search(where, match, regex)) {
|
||||
// std::cout << "matches for '" << where << "'\n";
|
||||
// std::cout << "Prefix: '" << match.prefix() << "'\n";
|
||||
// for (size_t i = 0; i < match.size(); ++i)
|
||||
// std::cout << i << ": " << match[i] << '\n';
|
||||
// std::cout << "Suffix: '" << match.suffix() << "\'\n\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user