[MDEV-24565] Please add a string function to count how often some character is in a string Created: 2021-01-11 Updated: 2022-05-21 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Wolfgang Formann | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In Wikipedia we often have article names with parenthesis like https://en.wikipedia.org/wiki/Walker_(surname) and it would be nice to have some function which enables me to find those, where the number of opening parenthesis matches the numer of closing ones. Current solution is a query like It would be a lot easier to write a query like |
| Comments |
| Comment by Sergei Golubchik [ 2022-05-20 ] | |||||||
|
you can use regular expressions for that, a regex to match recursive parentheses is easy to google:
| |||||||
| Comment by Wolfgang Formann [ 2022-05-20 ] | |||||||
|
Sergei, I want to find all those strings having a different number of opening parenthesis compared to the number of closing ones. Although your idea with matching parenthesis might be more strict, it does not seem to work as I expect and oes not really match my requirement. | |||||||
| Comment by Daniel Black [ 2022-05-21 ] | |||||||
|
Using regexp_replace of every other character and compare lengths:
|