Finding duplicate letters in a string beginning and ending at certain positions in MariaDB?
0
votes
3
answers
492
views
I need to find all strings containing double letters in positions between 4th and 10th inclusive.
I can find all double letters by
'([a-zA-Z])\1{1,3}';
and positions by
SELECT SUBSTRING(columnmame, 4, 9 ) FROM mytable;
but I do not know how to combine them?
so that the following examples are found:
Liverpool;
Sheffield Central.
but not
Arran.
I have tried
WITH cte AS (
SELECT *, SUBSTRING(columnmame, 4, 9) AS c
FROM mytable
)
SELECT *
FROM cte
WHERE c REGEX '([a-zA-Z])\1{1,3}';
I am aware that MariaDB does not support backreferences such as '\1'.
Asked by Bluetail
(103 rep)
Aug 25, 2022, 10:06 AM
Last activity: Aug 26, 2022, 08:03 AM
Last activity: Aug 26, 2022, 08:03 AM