Tweak image regexp check to fix #313

Comparing the `.match()` against `false` always returns false, even if `match()` finds nothing and returns `null`. Switched comparison to use `RegExp.test` at the same time for performance (and for simple true or false return type)