Open akgold opened 4 years ago
URLs (http and https) too, maybe.
Phone numbers are complicated if you want to support multiple locales but looks like there's a dialr package which wraps Google's libphonenumber, looks promising.
I had a look at dialr but there is a dependency on rJava which I think is undesirable. I was hoping to find an R port of libphonenumber-js
but that is not a thing.
IPs would be great. Something like: https://rdrr.io/cran/iptools/src/R/is.R and valid filenames (e.g. for Windows) would be helpful.
Full phone number validation isn't really feasible just because of the workload. Every country has their own formatting and often also legacy numbers that don't follow the current rules. The closest you could get I think would be requiring numbers start with a +, a recognized country code, and a fairly generous minimum and maximum length. Something like 5-15 digits inclusive of the country code (but not the leading +).
If these were added, I think it'd cover a large proportion of use cases.
Standard regexs for email + phone Checks for non-negative and strictly positive numbers