[MDEV-26958] Find second occurence with REGEXP_SUBSTR Created: 2021-11-02 Updated: 2021-11-05 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Tadas Balaišis | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I wonder, how can I find second/third occurrence with REGEXP_SUBSTR like I'm able to do in Oracle? |
| Comments |
| Comment by Tadas Balaišis [ 2021-11-03 ] | |||||||||||||||
|
I failed to find suitable regex expression for that. For now I found a workaround with substring_index (for comma separated string):
| |||||||||||||||
| Comment by Sergei Golubchik [ 2021-11-04 ] | |||||||||||||||
|
As a workaround, you can do it with two regexp_substr or with regex_replace, like
Note the number in curly braces {2} specifies the value you want. | |||||||||||||||
| Comment by Tadas Balaišis [ 2021-11-05 ] | |||||||||||||||
|
Excellent. Thanks. |