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.
我需要一个正则表达式,它给了我未关闭的标签,我可以找到它们并以编程方式关闭它们。
就像,我有以下文字
<tag> <p> hello world <p> this is <p>test.</p> this is test. <p> end it </tag>
我想从中找到未关闭的标签并使用正则表达式关闭它们。
任何的想法??谢谢梅加娜
正则表达式不是此任务的合适工具。有关原因的令人信服的演示,请参见此处。
我建议你使用HTML Agility Pack来解析和重写 HTML。