提交 d96d5111 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix \\ handling in REGEXP_REPLACE() in Oracle mode

上级 a70f1902
...@@ -1430,6 +1430,10 @@ public class Function extends Expression implements FunctionCall { ...@@ -1430,6 +1430,10 @@ public class Function extends Expression implements FunctionCall {
sb.append('$'); sb.append('$');
continue; continue;
} }
if (c == '\\') {
sb.append('\\');
i++;
}
} }
} }
sb.append(c); sb.append(c);
......
...@@ -26,6 +26,12 @@ select regexp_replace('first last', '(\w+) (\w+)', '\2 \1') as X from dual; ...@@ -26,6 +26,12 @@ select regexp_replace('first last', '(\w+) (\w+)', '\2 \1') as X from dual;
> last first > last first
> rows: 1 > rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '\\2 \1') as X from dual;
> X
> --------
> \2 first
> rows: 1
select regexp_replace('first last', '(\w+) (\w+)', '$2 $1') as X from dual; select regexp_replace('first last', '(\w+) (\w+)', '$2 $1') as X from dual;
> X > X
> ----- > -----
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论