Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isPhone extension implementation is strongly incorrect. #172

Closed
MairwunNx opened this issue Nov 19, 2021 · 1 comment
Closed

isPhone extension implementation is strongly incorrect. #172

MairwunNx opened this issue Nov 19, 2021 · 1 comment

Comments

@MairwunNx
Copy link

val String.isPhone: Boolean
get() {
val p = "^1([34578])\\d{9}\$".toRegex()
return matches(p)
}

this regex fully incorrect and no matches much of possible numbers. ^1([34578])\\d{9}\$

image

Phone always must not checked or validated by regex because not one regex for all phone number cases. Phone always validating by code, or by regex but for only one culture.

@FunkyMuse
Copy link
Owner

Closed 43e8701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants