Find All Links Without Title Attribute & Images Without Alt Using Regular Expressions

These two regular expressions will save you a lot of time when you get tasked with optimising your website for search. These snippets will work in most code & text editors such as SublimeText 2 & 3, Edit Plus and Textmate.Select All Images With No Title Tag

<a\s+((class|id|href|target|style)="[^"]+"\s*)+/?>

Select All Images With No ALT Tag

<img\s+((width|height|border|class|id|src|usemap|hspace|vspace|style)="[^"]+"\s*)+/?>

Just a small caveat, never assume that these will match absolutely everything. Sometimes code spanning multiple lines etc. will not be captured by a 'catch-all' regular expression.

Previous
Previous

Wordpress: Enabling Page attributes for posts (sort_order)

Next
Next

Why Business Web Hosting Company Offers SEO Services