RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Image without alt attribute (.Net only)
Expression
\<img ((src|height|width|border)=:q:Wh*)*/\>
Description
This regex is good for finding image tags without alt tags. I used this for working on Section 508 compliance. This is a M$ flavored regex and probably won't work with anything else.
Matches
<ol><li>&lt;img src="pic.gif" width="84" height="119" border="0" /&gt;</li><li>&lt;img src="pic.gif" width="84" height="119"/&gt;</li><li>&lt;img src="pic.gif" width="84" border="0" /&gt;</li><li>&lt;img src="pic.gif" height="119" border="0" /&gt;</li><li>&lt;img src="pic.gif" border="0" /&gt;</li><li>&lt;img src="pic.gif" height="119" /&gt;</li><li>&lt;img width="84" height="119" border="0" src="pic.gif" /&gt;</li><li>&lt;img src="pic.gif"/&gt;</li><li>&lt;img src="pic.gif" /&gt;</li></ol>
Non-Matches
Any img tag with:<br><ol><li>An alt attribute</li><li>Javascript event function</li><li>Unquoted attributes</li><li>The ending / missing</li></ol>
Author Rating: Not yet rated. Richard Binnington
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials