473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Formatting phone numbers input

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
2 1662
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Shay Hurley | last post by:
this is probably a stupid question so apologies in advance. I am trying to format a number to look like a phone number with "-"'s between the numbers etc e.g. 15554256987 should be formatted as...
5
by: joemono | last post by:
Hello everyone! First, I appologize if this posting isn't proper "netiquette" for this group. I've been working with perl for almost 2 years now. However, my regular expression knowledge is...
7
by: ilona | last post by:
Hi all, I store phone numbers in the database as 123447775665554(input mask is used for input, and some numbers have extensions), and I also know from db if the number is Canadian, US, or some...
0
by: KentEMon | last post by:
I have a field in my SQL database table which has phone numbers stored with no "-" character. That is, 4540090 rather than 454-0090. I have a webform datagrid and wish to display these values in a...
4
by: Brian Henry | last post by:
I have phone numbers like this in a data table 123-435-1234 1231231234 432.234.2321 they all have different formatting, what I want to do is get them all formatted like this (123) 123-1234
10
by: JackM | last post by:
I'm still working on validating the phone numbers that are entered on a form but have come across a problem I don't understand how to fix. I can handle most instances when it's in regular US...
2
by: czbacnik | last post by:
Hello! All I want to do is have my phone numbers appear (555) 555-5555, but for some reason I keep getting all these weird -- in between the numbers. I read that I should put "(999) 999-9999"! as...
5
by: lim4801 | last post by:
I am currently in doing a program which is given by my tutor: Contemplate that you are working for the phone company and want to sell "special" phone numbers to companies. These phone numbers are...
4
by: Blue Streak | last post by:
Hello, Folks! Does anyone know of a website that lists the local phone number formats for each country? TIA...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.