Regular Expressions 101

Locate HTML tags name, attributes

Open Workspace
  • PCRE2 (PHP)
  • Match
0

Regular Expression

/
<(\s)*([a-z0-9]+)(\s)*([a-zA-z0-9%,;()="'?\.\-:_\[\]&{}\/\s]*)(>|(\s)*\/>)*
/
gm

Description

A basic regex formula to find out the HTML tag name and its attributes that are available within HTML tag.

Submitted by Anonymous