sahvx655-wq commented on PR #428: URL: https://github.com/apache/commons-validator/pull/428#issuecomment-5044317170
Fair point, the regionMatches/substring pair was doing work the pattern could do itself. I've moved the tag into IP_DOMAIN_REGEX as an optional capture group, `^\[((?i)IPv6:)?(.*)\]$`, so the match itself records whether the tag was present and isValidDomain just picks isValidInet6Address or isValidInet4Address based on group(1), with group(2) as the address. The (?i) is scoped to the tag group so the address part is unaffected, and the IPV6_TAG constant and string handling are gone. Behaviour is unchanged from the previous revision: tagged literals validate as IPv6 in any case, untagged ones as IPv4 only. The new test still passes and the full default mvn goal (rat, japicmp, checkstyle, spotbugs, pmd, javadoc) is BUILD SUCCESS. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
