我有包含HTML标记的行。例如
<b>Abc</b> <strong>Bca</strong>
所以我需要把它剪掉。正如我建议的那样,我需要找到像"%<%>%"这样的东西,并将其替换为"。
我该怎么做?对两个解决方案都感兴趣- MS SQL &;Oracle也。
假设表为yourtable
,字段为htmltag
SELECT
SUBSTRING(substring(htmltag,charindex('>',htmltag)+1,250),0,CHARINDEX('<',
substring(htmltag,charindex('>',htmltag)+1 ,250),0))
FROM yourtable
SQL FIDDLE
SELECT regexp_replace(htmltag, '<[^>]+>', '') htmltag
FROM yourtable
SQL FIDDLE