Regular Expressions 101

Closes properly self-closing tags in HTML

Open Workspace
  • PCRE (Legacy)
  • Match
0

Regular Expression

~
<([A-z0-9-_]+)(([^>"]+"[^"]*")*\s*)/>
~
gm

Description

In an HTML will replace all auto-closed tags (/>) with a proper tag closing. It works even if the tag has a closing sign (>) inside an attribute.

Submitted by nabab