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 字符串,其中包含如下字符
& and
i want to replace & with & but dont want to replave & of
我为此使用 VB.net。请建议谢谢。
像这样的模式应该有效:
&(?!nbsp;)
这将匹配任何& 未跟随的nbsp;.
&
nbsp;
例如:
Dim input = "& and " Dim output = Regex.Replace(input, "&(?!nbsp;)", "&")
但是,您可能还想处理比 this 更多的实体 。此模式将匹配任何& 未后跟可选#和一个或多个“单词”字符和一个;:
#
;
&(?!#?\w+;)