match()

Data / String Functions

Description

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

NameTypeDescription
sstd::stringthe string to search
patternstd::stringregular expression pattern

Returns

std::vector

Related

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; }