By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,265 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,265 IT Pros & Developers. It's quick & easy.

Formatting phone numbers input

P: n/a
RD
We always have to have an area code but user does not always have to dial
the long distance digit 1 before the area code.
When user does not have to make long distance call the phone number our
format is like (450) 123-4560.
When he does have to make a long distance call its like 1 (450) 123-4560.
I'm wondering how to specify the input mask to allow for both these cases..

Any help would greatly appreciated.

Thanks
RD

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try Regex

Dim reg As Regex
Dim pattern As String = "^1?\s?\(\d{3}\)\s?\d{3}-\d{4}$"
Dim number As String = "(450) 123-4560"
' Dim number As String = "1 (405) 123-4560"

Debug.WriteLine reg.IsMatch(number, pattern).ToString
"RD" <no****@nospam.net> wrote in message
news:e0*************@tk2msftngp13.phx.gbl...
We always have to have an area code but user does not always have to dial
the long distance digit 1 before the area code.
When user does not have to make long distance call the phone number our
format is like (450) 123-4560.
When he does have to make a long distance call its like 1 (450) 123-4560.
I'm wondering how to specify the input mask to allow for both these
cases..

Any help would greatly appreciated.

Thanks
RD

Nov 21 '05 #2

P: n/a
Oops, forget what I said.
"Some Guy" <my*****@there.com> wrote in message
news:11*************@corp.supernews.com...
Try Regex

Dim reg As Regex
Dim pattern As String = "^1?\s?\(\d{3}\)\s?\d{3}-\d{4}$"
Dim number As String = "(450) 123-4560"
' Dim number As String = "1 (405) 123-4560"

Debug.WriteLine reg.IsMatch(number, pattern).ToString
"RD" <no****@nospam.net> wrote in message
news:e0*************@tk2msftngp13.phx.gbl...
We always have to have an area code but user does not always have to dial
the long distance digit 1 before the area code.
When user does not have to make long distance call the phone number our
format is like (450) 123-4560.
When he does have to make a long distance call its like 1 (450) 123-4560.
I'm wondering how to specify the input mask to allow for both these
cases..

Any help would greatly appreciated.

Thanks
RD


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.