Skip to main content

msys.pcre.replace

Last updated March 2020

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

Was this page helpful?