Changed if() ordering top short-circuit the preg_match()

See: http://php.net/manual/en/language.operators.logical.php

Short-circuiting the if() statements should speed things up a bit.