Regex: match any html tag (remove, strip, delete)

spiros

  • Administrator
  • Hero Member
  • *****
    • Posts: 814029
    • Gender:Male
  • point d’amour
Match any html tag (remove, strip, delete regex)

Code: [Select]
</?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)/?>https://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx/

Match any tag with or without attribute
Code: [Select]
<(?:[A-Za-z_:][\w:.-]*(?=\s)(?!(?:[^>"\']|"[^"]*"|\'[^\']*\')*?(?<=\s)(?:term|range)\s*=)(?!\s*/?>)\s+(?:".*?"|\'.*?\'|[^>]*?)+|/?[A-Za-z_:][\w:.-]*\s*/?)>https://stackoverflow.com/questions/9008430/regex-to-match-html-tags-with-specific-attributes
« Last Edit: 06 Jul, 2020, 21:24:48 by spiros »


 

Search Tools