MCPcopy Create free account
hub / github.com/Kitware/CMake / RegexMatchAll

Function RegexMatchAll

Source/cmStringCommand.cxx:244–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244bool RegexMatchAll(std::vector<std::string> const& args,
245 cmExecutionStatus& status)
246{
247 //"STRING(REGEX MATCHALL <regular_expression> <output variable> <input>
248 // [<input>...])\n";
249 try {
250 std::string const& regex = args[2];
251 std::string const& outvar = args[3];
252 cm::CMakeString data{ cmMakeRange(args).advance(4) };
253
254 auto result = data.Match(regex, cm::CMakeString::MatchItems::All,
255 &status.GetMakefile());
256 // Store the result in the provided variable.
257 status.GetMakefile().AddDefinition(outvar, result.to_string());
258 return true;
259 } catch (std::exception const& e) {
260 status.SetError(
261 cmStrCat("sub-command REGEX, mode MATCHALL: ", e.what(), '.'));
262 return false;
263 }
264}
265
266bool RegexReplace(std::vector<std::string> const& args,
267 cmExecutionStatus& status)

Callers 1

HandleRegexCommandFunction · 0.85

Calls 9

cmMakeRangeFunction · 0.85
to_stringMethod · 0.80
cmStrCatFunction · 0.70
advanceMethod · 0.45
MatchMethod · 0.45
GetMakefileMethod · 0.45
AddDefinitionMethod · 0.45
SetErrorMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…