A little refactoring of the if statements.

This means it has to check fewer things, and fixes an error
if the regular expression doesn't match.
Spaces, not tabs
Merge pull request #3 from mollywhite/master

A little refactoring of the if statements.