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

Function RegexMatch

Source/cmStringCommand.cxx:222–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222bool RegexMatch(std::vector<std::string> const& args,
223 cmExecutionStatus& status)
224{
225 //"STRING(REGEX MATCH <regular_expression> <output variable>
226 // <input> [<input>...])\n";
227 try {
228 std::string const& regex = args[2];
229 std::string const& outvar = args[3];
230 cm::CMakeString data{ cmMakeRange(args).advance(4) };
231
232 auto result = data.Match(regex, cm::CMakeString::MatchItems::Once,
233 &status.GetMakefile());
234 // Store the result in the provided variable.
235 status.GetMakefile().AddDefinition(outvar, result.to_string());
236 return true;
237 } catch (std::exception const& e) {
238 status.SetError(
239 cmStrCat("sub-command REGEX, mode MATCH: ", e.what(), '.'));
240 return false;
241 }
242}
243
244bool RegexMatchAll(std::vector<std::string> const& args,
245 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…