Replace regex.exec through regex.test and remove double negation.