正则表达式

时间:2020-02-18 18:13:07

标签: regex oracle

需要替换此字符串

'急性毒物。 4; H302 | Eir Irrit。 2A; H319'

与此

'急性毒物。 4(H302)|眼睛刺激。 2A;(H319)'

基本上,我需要将所有 H 代码放在括号中。

我尝试过:

select REGEXP_replace('Acute Tox. 4 ;H302|Eye Irrit. 2A;H319',';H\d{3}','(H') from dual;

但这会导致:

Acute Tox. 4 (H|Eye Irrit. 2A(H

1 个答案:

答案 0 :(得分:1)

您可以使用:

select REGEXP_replace('Acute Tox. 4 ;H302|Eye Irrit. 2A;H319',';(H\d{3})',';(\1)') from dual;
相关问题