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

spiros

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

Code: [Select]
</?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)/?>Using a Regular Expression to Match HTML | You’ve Been Haacked

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*/?)>pattern matching - regex to match html tags with specific attributes - Stack Overflow
« Last Edit: 07 Mar, 2021, 12:25:44 by spiros »


 

Search Tools