Regular expression to match closing HTML tags

前端 未结 4 1660
清歌不尽
清歌不尽 2020-12-10 08:33

I\'m working on a small Python script to clean up HTML documents. It works by accepting a list of tags to KEEP and then parsing through the HTML code trashing tags that are

4条回答
  •  暖寄归人
    2020-12-10 09:09

    ]*>(.*?) 
    

    Matches the opening and closing pair of a specific HTML tag.

    <([A-Z][A-Z0-9]*)\b[^>]*>(.*?)
    

    Will match the opening and closing pair of any HTML tag.

    See here.

提交回复
热议问题