The regexp_match function returns a copy of substring of string str which matches the regular expression pattern.
Previous behavior of this function would cut the first characters of str until the end of regular expression matched substring. In this way str could be passed to this function again to find the next occurrence of substring that matches the regular expression. By default this behavior is not adopted by this function, but can be enabled for pre 3.2 compatibility by supplying the optional third parameter.
If either the pattern or str parameter contain wide characters this function will operate in wide mode, first converting any narrow characters to wide and returning a wide character response. Otherwise this function operates in narrow mode by default.
This function returns the a substring matching the regular expression.
CREATE PROCEDURE all_tokens(IN pattern VARCHAR, IN str VARCHAR) { DECLARE wrd VARCHAR; DECLARE ans VARCHAR; DECLARE str_i VARCHAR; ans:=''; str_i := str; wrd := regexp_match(pattern,str_i); WHILE (wrd IS NOT NULL) { ans := concat(ans,',',wrd); wrd := regexp_match(pattern, str_i, 1); }; RETURN ans; };