Skip to main content

Name

msys.pcre.split — Perform a PCRE split operation

Synopsis

msys.pcre.split(subject, pattern);

subject: string
pattern: string

Description

Perform a PCRE split operation.

require("msys.core");
require("msys.pcre");
require("msys.dumper");
local mod = {};

function mod:validate_connect(accept, vctx)
  local res, err = msys.dnsLookup('messagesystems.com', 'A');
  if res then
    if type(res[1]) == "string" then
      table.sort(res);
    end
    local i;
    local l = msys.pcre.split(msys.dumper.Dumper(res), "\\n");
    for i=1, #l do
      print("OK:", l[i]);
    end
  else
    print("ERROR:", msys.dumper.Dumper(err));
  end
  return msys.core.VALIDATE_CONT;
end

msys.registerModule("dns-test", mod);

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

See Also

Was this page helpful?