[bisq-network/bisq] Validate phone numbers (#3134)
battleofwizards
notifications at github.com
Sat Aug 24 20:37:49 UTC 2019
battleofwizards commented on this pull request.
> + this.callingCode = countryCallingCodes.getCallingCode(isoCountryCode);
+ this.normalizedCallingCode = countryCallingCodes.getNormalizedCallingCode(isoCountryCode);
+ }
+
+
+ @Override
+ public ValidationResult validate(String input) {
+ normalizedPhoneNumber = null;
+ ValidationResult result = super.validate(input);
+ if (!result.isValid) {
+ return result;
+ }
+ final String trimmedInput = input.trim();
+ boolean isCountryDialingCodeExplicit = trimmedInput.startsWith("+");
+ // remove non-digit chars: plus sign, dashes, parens, hashes, slashes and white spaces
+ String pureNumber = input.replaceAll("[\\+\\s+()\\-\\−\\#\\\\]", "");
Sure but that does not change the essence. Remove everything that is not digit-or-letter. That is better approach than haunting for specific chars. Try `"[^A-Za-z0-9]"` and adjust regarding expected capitalization.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3134#discussion_r317373646
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190824/da8aaae1/attachment.html>
More information about the bisq-github
mailing list