matchAll()
Data / String FunctionsDescription
Uses a regular expression to find all matches in a string.
Syntax
std::vector<std::vector<std::string>> matchAll(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::vector<std::string>> matchAll(const std::string& s, const std::string& pat) {
std::vector<std::vector<std::string>> out; std::regex re(pat);
auto it=std::sregex_iterator(s.begin(),s.end(),re), end=std::sregex_iterator();
for(;it!=end;++it){ std::vector<std::string> row; for(auto& x:*it) row.push_back(x.str()); out.push_back(row); }
return out;
}