match()
Data / String FunctionsDescription
Uses a regular expression to match a string. Returns a vector of matches.
Syntax
std::vector<std::string> match(std::string s, std::string pattern)
Parameters
| Name | Type | Description |
|---|---|---|
| s | std::string | the string to search |
| pattern | std::string | regular expression pattern |
Returns
std::vectorRelated
Under the Hood
From Processing.h:
inline std::vector<std::string> match(const std::string& s, const std::string& pat) {
std::vector<std::string> out; std::smatch m; std::regex re(pat);
if (std::regex_search(s,m,re)) for (auto& x:m) out.push_back(x.str());
return out;
}