Fixing bad ! conditional in if statement checking for a RegExp or not