summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-11-10 16:43:27 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-11-10 16:43:27 +0400
commit9e8202013a8e0fc5e5693d8a08ab831d7ae49253 (patch)
tree219044ff1950c93ff961a92c967377fcd8f39864 /mysql-test
parent080fdbf937cc01af61c141fb4e1918a3468948ea (diff)
downloadmariadb-git-9e8202013a8e0fc5e5693d8a08ab831d7ae49253.tar.gz
MDEV-6965 non-captured group \2 in regexp_replace
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_regexp_pcre.result6
-rw-r--r--mysql-test/t/func_regexp_pcre.test5
2 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result
index b777af767cb..641c4fddbf7 100644
--- a/mysql-test/r/func_regexp_pcre.result
+++ b/mysql-test/r/func_regexp_pcre.result
@@ -839,3 +839,9 @@ SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2');
REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2')
/abc
SET default_regex_flags=DEFAULT;
+#
+# MDEV-6965 non-captured group \2 in regexp_replace
+#
+SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that');
+REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that')
+1 this and that
diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test
index 7e8df840239..6710f5cf096 100644
--- a/mysql-test/t/func_regexp_pcre.test
+++ b/mysql-test/t/func_regexp_pcre.test
@@ -397,3 +397,8 @@ SET default_regex_flags='UNGREEDY';
SELECT REGEXP_SUBSTR('abc','.+');
SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2');
SET default_regex_flags=DEFAULT;
+
+--echo #
+--echo # MDEV-6965 non-captured group \2 in regexp_replace
+--echo #
+SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that');