HomeBlogGet Quote ABQJUGLogin

Syndication

RSSrssAtomatom

A shitty yet effective way to put alt attributes in img tags

Written by: Dan HinojosaThu, 4 Oct 2007 12:00 PM PDT .
Filed Under: regeximgalt
Search regex for:
<img(?!([^>])*alt)

and replace with
<img alt=""

It's not a great solution, but it will work.  I noticed there are a lot of people tripping over themselves to do something like this, so this is my clumsy solution if you can call it that.  I do need a better solution, but this will work. If anyone has something better please let me know.