Regular Expressions vs XPath when parsing HTML text

后端 未结 4 652
情书的邮戳
情书的邮戳 2021-01-19 18:12

I want to parse a HTML text and find special parts. For example a text in 3rd div of 1st row and 2nd column of a table. I

4条回答
  •  爱一瞬间的悲伤
    2021-01-19 19:09

    Here is the canonical Stackoverflow explanation for why you should not parse HTML with regex:

    RegEx match open tags except XHTML self-contained tags

    In general, you cannot parse HTML with regex because regex is not made to parse HTML. Just use XPath.

提交回复
热议问题