regexp_capture(string, pattern [,start_position])
Return each individual string captured using the regular expression. A capture is any part of the regular expression that has been surrounded with parenthesis. If the optional third argument is given, regexp_capture will skip to specified start_position before attempting to match the pattern.
A capture can contain subcaptures (nested parenthesis), resulting in a portion of the matched string being returned multiple times. In the third example below, the c1 variable will be assigned the value "123def" and the c1sub variable will be assigned the value "123".
If regexp_capture is not able to match the entire pattern, it returns the value null for all captures.
When a capture such as (.*) matches nothing, it is returned as the zero length string ''.
When a capture matches 0 times, such as ([a-z]){0,4} or (ABC)*, the capture is returned as the boolean value false instead of the zero length string '' to indicate that no value was matched.
If the regular expression pattern does not match the input string, the value null is returned.
Examples
foo, bar = regexp_capture( "foobar", "(f..)(b..)" )
c1, c2, c3 = regexp_capture( "foo;bar;baz", "^(.*);(.*);(.*)$")
c1, c1sub = regexp_capture("abc123def", "(([0-9]+).*)" )