473,385 Members | 1,838 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,385 software developers and data experts.

phone number regular expression problem

Hi,
I have a different requirement and it is :

I need to validate a phone number field.
It may or may not be a US phone number.

The constraints are :
***********************

# It should accept any number of numbers
# any number of - hyphens
# and one + symbol
# no other characters and alphabets are allowed

Thanks in advance

Venugopal.S

May 31 '06 #1
2 996


^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1}){0,1}98(\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$

May 31 '06 #2
Hi,

You should be able to get started with this, at least...

^[\d-]*\+?[\d-]*$

Hope that helps.

Dave
venu wrote:
Hi,
I have a different requirement and it is :

I need to validate a phone number field.
It may or may not be a US phone number.

The constraints are :
***********************

# It should accept any number of numbers
# any number of - hyphens
# and one + symbol
# no other characters and alphabets are allowed

Thanks in advance

Venugopal.S


May 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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...
1
by: Erik Jälevik | last post by:
I have a regular expression which I believe is correct but it's not behaving as expected. It is as follows: /\+?\d+*\d+/ The idea is that a phone number is allowed to be of the form: optional...
0
by: Brian Davis | last post by:
The problem is in the word boundary \b. A leading "(" will match as a word boundary before it gets to the test for a "(". Changing the expression to: (?n)(\b|\()1??\(?(?<areaCode>\d\d)?\)??(?...
3
by: Eddy Soeparmin | last post by:
Hi, How do I apply phone format in a string field? for example (770) 123-1234. Please let me know. Thanks. Eddy
2
by: Ori | last post by:
Hi, I'm looking for a good way to validate a US phone number and i though using regular expression for this. I want to support 3 different ways to enter a phone number: 1.Local Phone : 888-8899...
1
by: venu | last post by:
Hi, I have a different requirement and it is : I need to validate a phone number field. It may or may not be a US phone number. The constraints are : *********************** # It should...
3
by: venu | last post by:
Hi, I have a different requirement and it is : I need to validate a phone number field. It may or may not be a US phone number. The constraints are : *********************** # It should...
2
by: David C | last post by:
Is there a way to validate a specific phone# format on a control? I also want to be able to have the user enter an extension as part of the text. For example, the following would be valid. ...
1
by: hellboss | last post by:
Hi ! Can u tel me what is the expression (Regular expression) for the a field like Telephone number which Doesnt exceeds 6 digits Ex:999999 d{5} or ()* Can we use this expression , if...
5
by: Abhishek | last post by:
Hi this is my another validator in javascript to validate the Phone Number :-) <script language='javascript'> function funcCheckPhoneNumber(ctrtxtMobile,e){ if(window.event){ var strkeyIE =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.