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.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
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. |
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. |
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. |
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 {code:java} SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1'); # -> expected 4 got 1 {code} It returns 1 but I would have expected 4 as the position of oll Doing the same with replace works: {code:java} # replace works as expected SELECT REGEXP_REPLACE('a_kollision', 'o([lm])\\1', '???'); # -> a_k???ision -- OK {code} It seems that the trouble starts when using brackets in REGEXP_INSTR: {code:java} 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 {code} Checked with latest stable version 10.2.6, default settings. |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Assignee | Sergei Golubchik [ serg ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Assignee | Sergei Golubchik [ serg ] | Alexander Barkov [ bar ] |
Status | Stalled [ 10000 ] | In Review [ 10002 ] |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.2 [ 14601 ] |
Component/s | OTHER [ 10125 ] | |
Fix Version/s | 10.1.25 [ 22542 ] | |
Fix Version/s | 10.2.7 [ 22543 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Review [ 10002 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 80990 ] | MariaDB v4 [ 152239 ] |
bar, do you remember what was the reason for this m_subpatterns_needed in the first place, instead of always using array_elments(m_SubStrVec) ?