Bug #54427 allow REGEXP to not only return boolean values but also matchin regions
Submitted: 11 Jun 2010 12:57 Modified: 31 Jan 2020 13:35
Reporter: Ralf Hauser Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[11 Jun 2010 12:57] Ralf Hauser
Description:
mysql> SELECT 'Time: 20:11:35' REGEXP('^Time: (..):(..):(..)$');

correctly returns "1" since it matched matched.

how would I get the match-region $1 i.e. the value "20" or by $2 "11" etc.
?

Is there anything short of http://www.mysqludf.org/lib_mysqludf_preg/ 's 

SELECT PREG_CAPTURE('/(.*?)(fox)/' , 'the quick brown fox' ,2 );

?

How to repeat:
always

Suggested fix:
add PREG_CAPTURE
[23 Jun 2010 8:31] Susanne Ebrecht
Many thanks for writing a reasonable feature request.
[31 Jan 2020 13:35] Erlend Dahl
Fixed as of MySQL 8.0.4.