需要替换此字符串
'急性毒物。 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
答案 0 :(得分:1)
您可以使用:
select REGEXP_replace('Acute Tox. 4 ;H302|Eye Irrit. 2A;H319',';(H\d{3})',';(\1)') from dual;