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

Function RegexReplace

Source/cmStringCommand.cxx:266–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266bool RegexReplace(std::vector<std::string> const& args,
267 cmExecutionStatus& status)
268{
269 //"STRING(REGEX REPLACE <regular_expression> <replace_expression>
270 // <output variable> <input> [<input>...])\n"
271 std::string const& regex = args[2];
272 std::string const& replace = args[3];
273 std::string const& outvar = args[4];
274
275 try {
276 cm::CMakeString data{ cmMakeRange(args).advance(5) };
277
278 data.Replace(regex, replace, cm::CMakeString::Regex::Yes,
279 &status.GetMakefile());
280 // Store the result in the provided variable.
281 status.GetMakefile().AddDefinition(outvar, data);
282 return true;
283 } catch (std::exception const& e) {
284 status.SetError(
285 cmStrCat("sub-command REGEX, mode REPLACE: ", e.what(), '.'));
286 return false;
287 }
288}
289
290bool RegexQuote(std::vector<std::string> const& args,
291 cmExecutionStatus& status)

Callers 1

HandleRegexCommandFunction · 0.85

Calls 8

cmMakeRangeFunction · 0.85
cmStrCatFunction · 0.70
advanceMethod · 0.45
ReplaceMethod · 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…