任何人都可以使用替换或正则表达式替换函数来帮助我重新删除或删除一组行,以及要查找和替换的字符串模式
要从下面的文字
替换的行</properties>
<?xml version="1.0"?>
<properties>
文本
<COLLECT_PARALLELGRAMMAR1>global.grxml</COLLECT_PARALLELGRAMMAR1>
<COLLECT_INPUTMODES>voice dtmf</COLLECT_INPUTMODES>
<CONF_INPUTMODES>dtmf</CONF_INPUTMODES>
</ROW>
</properties>
<?xml version="1.0"?>
<properties>
<ROW>
<MODULE_NAME>main_menu_phone</MODULE_NAME>
<MODULE_DESCRIPTION>Main Menu for Customers with silver membership</MODULE_DESCRIPTION>
<MODULE_TYPE>phone</MODULE_TYPE>
答案 0 :(得分:1)
如果它只是文字而不是 XML ,那么您只需使用 REPLACE 。
例如,
SQL> WITH DATA AS
2 (SELECT '
3 <COLLECT_PARALLELGRAMMAR1>global.grxml</COLLECT_PARALLELGRAMMAR1>
4 <COLLECT_INPUTMODES>voice dtmf</COLLECT_INPUTMODES>
5 <CONF_INPUTMODES>dtmf</CONF_INPUTMODES>
6 </ROW>
7 </properties>
8 <?xml version="1.0"?>
9 <properties>
10 <ROW>
11 <MODULE_NAME>main_menu_phone</MODULE_NAME>
12 <MODULE_DESCRIPTION>Main Menu for Customers with silver membership</MODULE_DESCRIPTION>
13 <MODULE_TYPE>phone</MODULE_TYPE>' str
14 FROM dual
15 )
16 SELECT REPLACE(str, '</properties>
17 <?xml version="1.0"?>
18 <properties>', '') new_str
19 FROM data;
NEW_STR
--------------------------------------------------------------------------------------------
<COLLECT_PARALLELGRAMMAR1>global.grxml</COLLECT_PARALLELGRAMMAR1>
<COLLECT_INPUTMODES>voice dtmf</COLLECT_INPUTMODES>
<CONF_INPUTMODES>dtmf</CONF_INPUTMODES>
</ROW>
<ROW>
<MODULE_NAME>main_menu_phone</MODULE_NAME>
<MODULE_DESCRIPTION>Main Menu for Customers with silver membership</MODULE_DESCRIPTION>
<MODULE_TYPE>phone</MODULE_TYPE>