Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从字符串/数据库文本类型字段中删除所有 html 效果很好,我怎样才能省略中断标签:
update hazHRA set identityRisk=dbo.RegexReplace('<(?:[^>''"]*|([''"]).*?\1)*>', '',identityRisk,1,1);
我希望保留
<br>
只要
这应该做的工作:
(?i)<(?:(?!br>|br/>)[^>'"]*|(['"]).*?\1)*>
(?i):不区分大小写。
(?!br>|br/>):负前瞻。
在线演示。
如果您可以在前瞻中使用量词,则可以使用:
(?i)<(?:(?!br\s*>|br\s*/>)[^>'"]*|(['"]).*?\1)*>
这将确保不<br >与空格匹配。
<br >