Closed Shawn-sudo closed 1 year ago
Hi!
Maybe a solution is add support in this plugin to the method findNumbers
from libphonenumber. But, I don't know if exist a similar method on PhoneNumberKit.
Create and validate all RegEx for each country, is so hard that this plugin can't be offer this option in this moment
I ended up using RegExp(r'[+]?(\d{1,3})?[\s.-]?\(?\d{1,3}\)?[\s.-]?\d{2,4}[\s.-]?\d{2,4}[\s.-]?(\d{2,4})?')
, but this still doesn't support some countries that have special phone number format. I guess this isn't directly related to this plugin, so I'll close this.
Environment
Package version: 1.0.0
Description
What you'd like to happen:
Provide a
RegExp
of valid phone numbers.RegExp
is widely used to find a specific pattern in a text (string). To find for the phone number that a text contains, it'd be good to have theRegExp
provided.Example "Hey yo my phone number is +1 123 234 3456" --> "+1 123 234 3456" "Call me maybe 😉 123-2222-3333" --> "123-2222-3333"
RegEx for phone numbers that I found on the Internet:
^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3,4}[-\s\.]?[0-9]{4,6}$
I'm not sure if this would work well for every phone number formats of every country though.My ultimate goal Ultimately, I just want a way to easily find the phone number that a text (string) contains.
RegExp
may not be the only solution for this, so if there's a better way to do this than usingRegExp
, please tell me