Regex - I only want to match the start tags in regex

后端 未结 5 1516
醉话见心
醉话见心 2021-01-06 23:36

I am making a regex expression in which I only want to match wrong tags like:

*some text here, some other tags may be here as well but no ending \'p\' tag* &

5条回答
  •  醉话见心
    2021-01-07 00:27

    Regex is not always a good choice for xml/html type data. In particular, attributes, case-sensitivity, comments, etc all have a big impact.

    For xhtml, I'd use XmlDocument/XDocument and an xpath query.

    For "non-x" html, I'd look at the HTML Agility Pack and the same.

提交回复
热议问题