Regression: IPv6 detection is failing after isdigit() and similar changes.
The commit
50788517d37ece42f32f6906078d2d59330ec3c9 missed a not operator for the IPv6 address.
The unit tests revealed the problem.
This adds the missing exclamation character '!'.
I also overlooked some cases where I could perform the same optimization used for the referenced commit in some places.
Also use the literal ASCII characters rather than the strings.
The ASCII codes are required and expected and substitution of the characters for the algorithm do not make sense here.
These are characters rather than strings.