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

Get regex to use elsewhere #394

Closed
jpswade opened this issue Jul 29, 2020 · 4 comments
Closed

Get regex to use elsewhere #394

jpswade opened this issue Jul 29, 2020 · 4 comments

Comments

@jpswade
Copy link

jpswade commented Jul 29, 2020

It'd be really nice if there was some kind of interface that you could use to get the phone number regex so you could use that within HTML5 regex so the two could be consistent.

See: http://html5pattern.com/Phones

@giggsey
Copy link
Owner

giggsey commented Jul 29, 2020

I would recommend grabbing a JavaScript version of libphonenumber in order to do frontend validation.

@jpswade
Copy link
Author

jpswade commented Jul 29, 2020

That’s how you get inconsistencies...

@giggsey
Copy link
Owner

giggsey commented Jul 29, 2020 via email

@jpswade
Copy link
Author

jpswade commented Jul 29, 2020

I'm really only interested in one region for general purposes, which is why pulling in large javascript packages of hundreds of megabytes seems a bit overkill, while, if it could be pulled from this library, in theory, it should evaluate to a few bytes.

Google's libphonenumber supports javascript out of the box and is 1.2kb when minified and gzipped so this might just do the trick.

@jpswade jpswade closed this as completed Jul 29, 2020
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