regex.exec, regex.execW

LuaFAR 3

regex.exec, regex.execW


from, to, offsets = regex.exec (s, pattern, [init], [cflags])

Parameters:
  s       :  string
  pattern :  string
  init    :  integer (default=1; can be negative)
  cflags  :  string (any combination of 'i','m','o','s' and 'x')

Returns:
  from    : integer
  to      : integer
  offsets : table - array of captures' offsets (there can be false
                    in place of captures not participated in the match)

Example:
  If the whole match is at offsets 10,20 and substring matches are
  at offsets 12,14 and 16,19 then the function returns the following:
  10, 20, { 12,14,16,19 }.

Note:
regex.execW receives its 1-st argument in UTF-16LE encoding.

Far API used:
  RegExpControl