Home > database > Oracle regular expression to replace specific label and inside content
Oracle regular expression to replace specific label and inside content
Time:10-04
Now oracle database with HTML tags in a certain field of string, and now want to take style="display: none" label and replace the content of the inside is empty characters, and great god teach some labels may be nested with style="display: none" attribute, string the following A: string & lt; p> Excuse me, excuse me, excuse me, & lt; Span _fck_bookmark="1" style="display: none" & gt; & NBSP party and & lt; Span _fck_bookmark="1" style="display: none" & gt; & NBSP party and for the case plan China & lt;/span> In plan China & lt;/span> Scheme and as a Mr Assad & lt;/p> Should be replaced as follows: String B: & lt; p> Excuse me, excuse me, excuse me, & lt; Span _fck_bookmark="1" style="display: none" & gt; & NBSP party and for the case plan China & lt;/span> Scheme and as a Mr Assad & lt;/p>
Replacement should be: excuse me, excuse me, excuse me, scheme and as a Mr Assad Could you tell me how to write great god regular type should be? Can replace many times will now display the take out, in the replacement label
CodePudding user response:
SQL> The select regexp_replace (regexp_replace (' & lt; p> Excuse me, excuse me, excuse me, & lt; Span _fck_bookmark="1" style="display: none" & gt; Party and & lt; Span _fck_bookmark="1" style="display: none" & gt; Plan China party and case & lt;/span> In plan China & lt;/span> Scheme and as a Mr Assad & lt;/p> ', '& lt; Span _fck_bookmark="1" style="display: none" & gt; . * & lt;/span> ', ' '), '& lt; }. {1, 2 & gt; ', ' ') 2 the from dual;
REGEXP_REPLACE (REGEXP_REPLACE (' & lt; P -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Excuse me, excuse me, could you please tell me, scheme and as a Mr Assad