Friday, January 12, 2018

SQL to remove HTML Tags from the text


Here is the query to eliminate html tags and other entities like &amp ,&nbsp etc. 



SELECT trim(regexp_replace('<p style="margin-left:30px;">Replacing html tags &amp; entities with space using regular expresion&nbsp;.</p>',
'<.+?>|\&(nbsp;)|(amp;)|(quot;)|(lt;)|(gt;)', ' ')) as plain_col
FROM dual ;


Result will be 

PLAIN_COL
------------------------------------------------------------------------------------
Replacing html tags &  entities with space using regular expression.

No comments:

Post a Comment