Same optimization for isNotSanitizedByRegex.