msys.pcre.replace

March 26, 2020 Contributors

Name

msys.pcre.replace — Perform a PCRE replace operation

Synopsis

msys.pcre.replace(subject, pattern, replacement);

subject: string
pattern: string
replacement: string

Description

Perform a PCRE replace operation.

...
  local orig = self:text();
  if orig == nil then
    return false
  end
  local rep = msys.pcre.replace(orig, pattern, replacement);
  if rep ~= orig then
    self:text(rep, ct.mimetype, ct.charset);
    return true;
  end

Enable this function with the statement require('msys.pcre').

See Also

msys.pcre.match, msys.pcre.split