Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1.13, 10.2.6
-
None
-
ms windows 7 Home Premium 64 bit, Intel i5 750
Description
MariaDB Documentation says about REGEXP_INSTR: Returns the position of the first occurrence of the regular expression pattern in the string subject, or 0 if pattern was not found.
My task is (simplified): finding o followed by a double consonant
SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1'); # -> expected 4 got 1 |
It returns 1 but I would have expected 4 as the position of oll
Doing the same with replace works:
# replace works as expected
|
SELECT REGEXP_REPLACE('a_kollision', 'o([lm])\\1', '???'); # -> a_k???ision -- OK |
It seems that the trouble starts when using brackets in REGEXP_INSTR:
SELECT REGEXP_REPLACE('a_kollision', 'oll', '???'); # -> a_k???ision -- OK |
SELECT REGEXP_REPLACE('a_kollision', '(oll)', '???'); # -> a_k???ision -- OK |
SELECT REGEXP_INSTR('a_kollision', 'oll'); # -> 4 -- OK |
SELECT REGEXP_INSTR('a_kollision', '(oll)'); # -> 1 -- wrong |
Checked with latest stable version 10.2.6, default settings.