[MDEV-27043] REGEXP / REGEXP_REPLACE operations with empty source string match, but do not replace Created: 2021-11-14 Updated: 2021-11-14 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Parser |
| Affects Version/s: | 10.4.12 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Sybille Peters | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | regexp, regexp_replace | ||
| Environment: |
mysql console |
||
| Description |
|
REGEXP_REPLACE does not replace a match with source string empty string (''), but REGEXP does match the empty string with a similar regex (.*). This seems inconsistent. Examples: Example 1. REGEP_REPLACE with empty source string: does not replace
Example 2. REGEXP with empty source string: does match
Example 3: compare with perl:
I posted the question on Stack Overflow and was referred here. I wasn't sure if this was really a bug, but it seems inconsistent - MariaDB uses https://mariadb.com/kb/en/pcre/, the perl command line as well as regex101 using perl do a replacement on the empty string. |