Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9e820201
Commit
9e820201
authored
Nov 10, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-6965 non-captured group \2 in regexp_replace
parent
080fdbf9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
mysql-test/r/func_regexp_pcre.result
mysql-test/r/func_regexp_pcre.result
+6
-0
mysql-test/t/func_regexp_pcre.test
mysql-test/t/func_regexp_pcre.test
+5
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+8
-5
No files found.
mysql-test/r/func_regexp_pcre.result
View file @
9e820201
...
@@ -839,3 +839,9 @@ SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2');
...
@@ -839,3 +839,9 @@ SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2');
REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2')
REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2')
/abc
/abc
SET default_regex_flags=DEFAULT;
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
...
...
mysql-test/t/func_regexp_pcre.test
View file @
9e820201
...
@@ -397,3 +397,8 @@ SET default_regex_flags='UNGREEDY';
...
@@ -397,3 +397,8 @@ SET default_regex_flags='UNGREEDY';
SELECT
REGEXP_SUBSTR
(
'abc'
,
'.+'
);
SELECT
REGEXP_SUBSTR
(
'abc'
,
'.+'
);
SELECT
REGEXP_REPLACE
(
'abc'
,
'^(.*)(.*)$'
,
'\\1/\\2'
);
SELECT
REGEXP_REPLACE
(
'abc'
,
'^(.*)(.*)$'
,
'\\1/\\2'
);
SET
default_regex_flags
=
DEFAULT
;
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'
);
sql/item_strfunc.cc
View file @
9e820201
...
@@ -1379,13 +1379,16 @@ bool Item_func_regexp_replace::append_replacement(String *str,
...
@@ -1379,13 +1379,16 @@ bool Item_func_regexp_replace::append_replacement(String *str,
break
;
/* End of line */
break
;
/* End of line */
beg
+=
cnv
;
beg
+=
cnv
;
if
((
n
=
((
int
)
wc
)
-
'0'
)
>=
0
&&
n
<=
9
&&
n
<
re
.
nsubpatterns
())
if
((
n
=
((
int
)
wc
)
-
'0'
)
>=
0
&&
n
<=
9
)
{
if
(
n
<
re
.
nsubpatterns
())
{
{
/* A valid sub-pattern reference found */
/* A valid sub-pattern reference found */
int
pbeg
=
re
.
subpattern_start
(
n
),
plength
=
re
.
subpattern_end
(
n
)
-
pbeg
;
int
pbeg
=
re
.
subpattern_start
(
n
),
plength
=
re
.
subpattern_end
(
n
)
-
pbeg
;
if
(
str
->
append
(
source
->
str
+
pbeg
,
plength
,
cs
))
if
(
str
->
append
(
source
->
str
+
pbeg
,
plength
,
cs
))
return
true
;
return
true
;
}
}
}
else
else
{
{
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment