Phone number validation doesn't really work correctly
See original GitHub issueA UK phone number is of the format +44 1234 123456 (country area number). I only include the spaces here to illustrate the format.
It won’t accept as valid even if you give the country code as 0044. I’ve also tried it with my Polish phone number and it won’t accept that either.
I’ve just noticed that the regex is in the code sample itself:
questions = [
inquirer.Text('name', message="What's your name"),
inquirer.Text('surname', message="What's your surname"),
inquirer.Text('phone', message="What's your phone number",
validate=lambda x, _: re.match('\d+', x),
)
]
However, there’s no value I seem to be able to give it that will pass validation. I haven’t forgotten to import re.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Can't verify phone number - Android - Google Duo Help
Make sure your phone number was entered correctly with the right country code. Step 2: Check for a good Wi-Fi or mobile data...
Read more >Phone number validation Android - Stack Overflow
Use isGlobalPhoneNumber() method of PhoneNumberUtils to detect whether a number is valid phone number or not. Example.
Read more >Bad Practices on Phone Number Form Fields - UX Movement
Your users should not wonder which phone number format is valid or get a validation error for the wrong phone number format.
Read more >Phone Number Validation: Verify Numbers in 3 Seconds
Use our easy-to-use phone number verification tool to expand your contact database and validate phone numbers before you reach out to customers.
Read more >Working with Angular 4 Forms: Nesting and Input Validation
Validating user inputs is an essential part of any robust web application. Angular 4 makes it especially easy for both template-driven and reactive...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see… You mean in the documentation. Good point. I’ll try to fix it as soon as I could.
Ehm,
validate=True
means it is always valid, sooo nothing interesting there. Otherwise, thevalidate
function is called with signaturevalidate(previous_answers, current_value_of_current_question)
, therefore you are interested in the second argument 😉 I tried the current example in master and it worked as expected, that said it is not somehow advanced validation it just shows how it works…