Don't duplicate the regex - instead store the result of match in a var and set version to 999 if it's null.