如何更换& nbsp;太空? [英] How to replace   to space?
本文介绍了如何更换& nbsp;太空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
内容是
Hello World.
<a href="#" target=_blank>hello World</a>
如何替换& nbsp;
在HTML代码中,并在文本中保留其他& nbsp;
。
How to replace the
in html code and keep the other
in the text.
推荐答案
您可以尝试搜索
(?<=<[^>]*)
并用单个空格替换它?
这会寻找& nbsp;
内的标签(以<
开头,可能还有其他字符,但>
)。
This looks for
inside tags (preceded by a <
and possibly other characters except >
).
但这非常脆弱。例如,如果您在字符串/属性中包含<
/ >
符号,它将失败。最好避免把那些& nbsp;
首先放在错误的位置。
This is extremely brittle, though. For example, it will fail if you have <
/>
symbols in strings/attributes. Better avoid getting those
into the wrong locations in the first place.
这篇关于如何更换& nbsp;太空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文