regex.gsub, regex.gsubW

LuaFAR 3

regex.gsub, regex.gsubW


res, nmatch, nrep = regex.gsub (s, pattern, repl, [n], [cflags])

Parameters:
  s:        string
  pattern:  string
  repl:     string, or table, or function
  n:        integer
  cflags:   string (any combination of 'i','m','o','s' and 'x')

Returns:
  res:      string
  nmatch:   integer
  nrep:     integer

Description:
  The function is API-compatible with string.gsub, with the
  following extensions:
  -- cflags : optional 5-th parameter: compilation flags;
  -- nrep   : 3-rd return value: number of replacements made;
  -- repl can specify more captures than in string.gsub: %0-%9, %A-%Z (or %a-%z).

Note:
regex.gsubW receives its 1-st argument and returns captures in
UTF-16LE encoding.

Far API used:
  RegExpControl