REGEXFINDSET

REGEXFINDSET(regex, text [, NOCASE])

regexA standard Perl regular expression.
textThe text to parse.
NOCASEOptional. Specifies a case insensitive search.
Return:REGEXFINDSET returns a set of strings.

The REGEXFINDSET function uses the regex to parse through the text and find matches. The regex must be a standard Perl regular expression.

We use a third-party library -- Perl-compatible Regular Expressions (PCRE2) to support this. See https://www.pcre.org/current/doc/html/pcre2syntax.html for details on the PCRE2 pattern syntax.

REGEXFINDSET ignores capture groups. REGEXFINDSET repeatedly extracts the text matching the entire regex pattern.

Example:

sampleStr := 
  'To: jane@example.com From: john@example.com This is the winter of our discontent.';
eMails:=REGEXFINDSET('\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}' , sampleStr);
OUTPUT(eMails);

UNICODE sampleStr2:= 
  U'To: janë@example.com From john@example.com This is the winter of our discontent.';
eMails2:= REGEXFINDSET(U'\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}', sampleStr2);
OUTPUT(eMails2);

See Also: PARSE, REGEXFIND, REGEXREPLACE