Find all links without title attribute

06 July 2011

To create good and usable sites, it's important to use a title attribute on all your links. When creating a site it's often forgotten, but with this regular expression you can easilly do it afterwards.

All you have to do is open the "find in folder" function in you editor and enter this regex in the searchfield. Don't forget to enable the "use regular expressions" option in the search box:

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

If your editor doesn't support regular expression searches you really should get one. This option can safe you a lot of time!

To find all images without alt attribute, you can use this regex:

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

But never assume this regexes match everything, because when using multiline code or some unexpected formats, the regex will not match!
You must have JavaScript enabled to use this form!

Leave a comment!

  1. Your mail is safe with me. It's only only used to display your Gravatar image!

1 comment

  1. Gravatar

    Wawrzek

    12 April 2012

    Well, it didn't work for me - I don't know why. At last I did:

    grep -i href * | grep -v title

    what returned me what I wanted. Even though - thanks for help!