HTML Tag
Matches HTML tags
Live Tester— test the HTML Tag pattern
Pattern
/<\/?[a-zA-Z][a-zA-Z0-9]*(?:\s[^>]*)?\/?>/Should match →
Should not match →
Pattern
<\/?[a-zA-Z][a-zA-Z0-9]*(?:\s[^>]*)?\/?>
Matching examples
<div><img src='x' /></p>Non-matching examples
< div>textBreakdown
- <\/?
- Opening < or </
- [a-zA-Z][a-zA-Z0-9]*
- Tag name
- (?:\s[^>]*)?
- Optional attributes
- \/?>
- Optional /, closing >