Reputation: 2001
Have a table:
| id | Name |
|----------------------|
| 1 |test1 test1 test1|
| 2 |test2 test2 test2|
Want to select 1st regex group (used 1st word to simplify), so my query:
SELECT regexp_replace(name, "^([[:alnum:]]+)[[:space:]].*$","$1") FROM table;
Result:
|test1 |
|test1test2 |
So how it comes that result is accumulated? And how to avoid it and still be able to use regex group?
UPD: Mysql version: 8.0.11, MySQL Community Server - GPL
Upvotes: 3
Views: 4120
Reputation: 142518
https://bugs.mysql.com/bug.php?id=90803 - May 21:
Fixed in 8.0.12.
REGEXP_RELACE() results from one result set row could carry forward to the next row, resulting in accumulation of previous results in the current row.
Upvotes: 1