-
Notifications
You must be signed in to change notification settings - Fork 105
doesn't parse numbers with extensions? #13
Comments
This would be a nice feature. |
truth |
I know this was a long time ago, but I'm not sure what feature you're requesting. You want numbers with extensions to be parsed? Or you think that parsing them should return an error and not nil? If you're still interested in this feature can you clarify it and I'll reopen this issue. Thanks! |
I think the requested feature was to start parsing numbers with extensions. Right now, I'm using a regex to grab the part of the number in front of the extension before parsing it, but it would be nice if # In order to allow for extensions, we have to split on the first character that's not
# a digit, white space character, parenthesis, period, plus sign, or minus sign, then
# parse the first part.
phone_string = '(201) 482-4764x1234'
number_part = phone_string.split(/[^\d\s\(\)\.\-\+]/).first
parsed_number = GlobalPhone.parse(number_part) |
Thanks @trliner, I better understand the issue now. If anyone is interested in a PR that would be great. I'm not sure when I'll get around to implementing this, but I'll reopen. |
Strike this, just realized this is a re-implementation and not a wrapper.
|
2.0.0-p247 :013 > GlobalPhone.parse('(201) 482-4764x1234')
=> nil
2.0.0-p247 :014 > GlobalPhone.parse('+12014824764x1234')
=> nil
2.0.0-p247 :015 > GlobalPhone.parse('+12014824764 ext. 1234')
=> nil
The text was updated successfully, but these errors were encountered: