如何使用带有正则表达式的ID从表中获取内容?
问题描述:
我需要对html字符串进行排序,以便获得我需要的内容。现在我需要遍历具有ID的表中的表行。如何使用正则表达式执行此操作?
I need to sort a html string so I get the content I need. Now I need to loop through the table rows in a table that have an ID. How do I do this with a regex?
答
正则表达式不能用于解析HTML; HTML不常规。使用正确的HTML解析器库。
Regular expressions cannot be used to parse HTML; HTML is not regular. Use a proper HTML parser library.