How can I remove unused, nested HTML span tags with a Perl regex?

后端 未结 4 1143
南旧
南旧 2021-01-06 10:23

I\'m trying to remove unused spans (i.e. those with no attribute) from HTML files, having already cleaned up all the attributes I didn\'t want with other regular expressions

4条回答
  •  滥情空心
    2021-01-06 11:01

    Don't use regexps for processing (HTML ==) XML. You never know what input you'll get. Consider this, valid HTML:

    a b c de
    

    Would you have thought of that?

    Use an XML processor instead.

    Also see the Related Questions (to the right) for your question.

提交回复
热议问题