From 30ad3354b9786a4db54643b127a88aaa073c0237 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 3 Oct 2013 14:28:57 +0400 Subject: [PATCH] MDEV-4425 Regexp enhancements Adding tests with 0x00 characters from Bug#70470 REGEXP fails to find matches after NUL character --- mysql-test/r/func_regexp_pcre.result | 9 +++++++++ mysql-test/t/func_regexp_pcre.test | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result index e001e52bc55..4ae66e24eda 100644 --- a/mysql-test/r/func_regexp_pcre.result +++ b/mysql-test/r/func_regexp_pcre.result @@ -414,6 +414,15 @@ SELECT '!' RLIKE '\\S'; SELECT '.' RLIKE '\\S'; '.' RLIKE '\\S' 1 +SELECT 'abc\0def' REGEXP 'def'; +'abc\0def' REGEXP 'def' +1 +SELECT 'abc\0def' REGEXP 'abc\\x{00}def'; +'abc\0def' REGEXP 'abc\\x{00}def' +1 +SELECT HEX(REGEXP_SUBSTR('abc\0def','abc\\x{00}def')); +HEX(REGEXP_SUBSTR('abc\0def','abc\\x{00}def')) +61626300646566 # # Checking REGEXP_REPLACE # diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test index ff0ee569b1a..7a4be163001 100644 --- a/mysql-test/t/func_regexp_pcre.test +++ b/mysql-test/t/func_regexp_pcre.test @@ -144,6 +144,13 @@ SELECT '1' RLIKE '\\S'; SELECT '!' RLIKE '\\S'; SELECT '.' RLIKE '\\S'; +# checking 0x00 bytes +# Bug#70470 REGEXP fails to find matches after NUL character +SELECT 'abc\0def' REGEXP 'def'; +SELECT 'abc\0def' REGEXP 'abc\\x{00}def'; +SELECT HEX(REGEXP_SUBSTR('abc\0def','abc\\x{00}def')); + + --echo # --echo # Checking REGEXP_REPLACE --echo #