regexp-search added, std lib loader changes, more REadme items

This commit is contained in:
2021-02-21 14:03:14 +01:00
parent 0ba8536aa2
commit a87964f552
8 changed files with 97 additions and 40 deletions

View File

@@ -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 &regex_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;
}