Let’s compile a list of functions in SQL that work with regular expressions. So far, we’ve been focusing mainly on filtering records with regular expressions, but there’re 2 more applications we need to learn – text extraction and modification.
regexp_matches(text_input, regex)
The regexp_matches()
function returns an array of all captured substrings (the whole string that matched the regex OR multiple matched patterns from capturing groups ()
).
It’s a very useful function for debugging regular expressions and for text extraction as well. Let’s...