Grouping in REGEXP_SUBSTR() in MySQL 8.x
P粉514458863
P粉514458863 2024-04-02 11:56:00
0
1
380

I'm trying to use a regular expression that I know about, but it doesn't seem to work in MYSQL v8.0. I'm trying to extract the filename (something.txt) from some_str variable. It keeps returning NULL. Not sure what I'm doing wrong in the pattern.

set @some_str = "{'A': 1234, 'fname': 'something.txt'}";
select regexp_substr(@some_str, "\{'\w+':\s+\d+,\s+'\w+':\s+'(.+)'\}") ;
-- should return:  something.txt

P粉514458863
P粉514458863

reply all(1)
P粉670838735

dbviolinhere p>

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!