正则表达式
假设我们只想用 2 位数替换数字:正则表达式将使用 (\d\d)
找到它们
SELECT REGEXP_REPLACE ('2, 5, and 10 are numbers in this example', '(\d\d)', '#')
FROM dual;
结果是:
'2, 5, and # are numbers in this example'
如果我想交换部分文本,我使用\1
,\2
,\3
来调用匹配的字符串:
SELECT REGEXP_REPLACE ('swap around 10 in that one ', '(.*)(\d\d )(.*)', '\3\2\1\3')
FROM dual;