Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

~
<([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 - 2 years ago