Author Topic: Regular expression (regex) to match any html tag with or without attribute  (Read 111 times)

spiros

  • Administrator
  • Hero Member
  • *****
  • Posts: 296449
  • Gender: Male
  • point d’amour
    • spiros.doikas
    • greektranslator
    • doikas
    • 102094522373850556729
    • lavagraph
    • Greek translator CV
Regular expression (regex) to match any html tag with or without attribute

Code: [Select]
<(?:[A-Za-z_:][\w:.-]*(?=\s)(?!(?:[^>"\']|"[^"]*"|\'[^\']*\')*?(?<=\s)(?:term|range)\s*=)(?!\s*/?>)\s+(?:".*?"|\'.*?\'|[^>]*?)+|/?[A-Za-z_:][\w:.-]*\s*/?)>