Comments - REGEXP_SUBSTR
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
Thrilled that MariaDB supports PCRE, one of the best engines out there.
It seems to me that the REGEXP_SUBSTR function is missing an optional parameter. It would be more useful as
REGEXP_SUBSTR(subject,pattern,group)
where group is 0 by default.
I realize you can do something like
regexp_replace(subject, pattern, '@1')
but that is not super intuitive.
(The @ is actually a double backslash that I don't know how to render on this comment system.)
There is one work-around. You can use \K and (?=) to look-ahead and look-behind your subject.
For example: