RE_REPLACE(input_expr, reg_exp, replace_string, options) is to Replace portions of input_expr that match reg_exp with replace_string.
RE_REPLACE can also be used to extract/output the substrings that match reg_exp. The key is to use match groups () and then references to those match groups in the replace string ($1, $2, etc) for the 1st, 2nd, etc., groups. And the "c" option, which causes it to not copy to the output portions of the string which did not match.
For example: to extract the first substring that match the regular expression
Note that by default, these use Perl-like syntax for regular expression patterns, so a google search for "Perl regular expressions" will give tons of documentation and examples.