function regex input String str; input String re; input Integer maxMatches = 1 "The maximum number of matches that will be returned"; input Boolean extended = true "Use POSIX extended or regular syntax"; input Boolean caseInsensitive = false; output Integer numMatches "-1 is an error, 0 means no match, else returns a number 1..maxMatches"; output String matchedSubstrings[maxMatches] "unmatched strings are returned as empty"; end regex;