473,405 Members | 2,187 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.

Regular expression for validate

Hello everybody,
I have problem with regular expression.
I want "code" telephon number and I have two types number:
1) [xx] [xxx xxx xxx] or
2) [xx] ([xx] or [xxx]) [xxx xx xx]
where x - is digital

Maybe someone know where is simple description regular expression - for
complitly beginner.

Thx

Nov 17 '05 #1
2 1395
Hi Pawel,

Look for "Regular Expression" in VS .NET docs.

SAMPLE - Rational number:

(([0-9]+.[0-9]*)|([0-9]*.[0-9]+)|([0-9]+))

"[0-9]" means that any digit from 0 to 9
(or use ":d" instead)
"+" - one or more occurence
"*" - zero or more occurence
"|" - or expression

E.g. polish post code pattern (but i don't test it):
^[0-9][0-9]-[0-9][0-9][0-9]$
or
^:d:d-:d:d:d$

HTH
Marcin
Hello everybody,
I have problem with regular expression.
I want "code" telephon number and I have two types number:
1) [xx] [xxx xxx xxx] or
2) [xx] ([xx] or [xxx]) [xxx xx xx]
where x - is digital

Maybe someone know where is simple description regular expression - for
complitly beginner.

Thx

Nov 17 '05 #2
Hi,

The following expression should take care of your syntax requirements.

\[\d{2,3}\]\s((\(\[\d{2,3}\]\))?)\s\[\d{3}\s?\d{3}\s?\d{3}\]

Just stick the cheque in the post. ;-)
"PawelR" <pa************@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello everybody,
I have problem with regular expression.
I want "code" telephon number and I have two types number:
1) [xx] [xxx xxx xxx] or
2) [xx] ([xx] or [xxx]) [xxx xx xx]
where x - is digital

Maybe someone know where is simple description regular expression - for
complitly beginner.

Thx

Nov 17 '05 #3

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

Similar topics

2
by: Christian Staffe | last post by:
Hi, I would like to check for a partial match between an input string and a regular expression using the Regex class in .NET. By partial match, I mean that the input string could not yet be...
7
by: Chris Kennedy | last post by:
Does anyone know a regular expression that will validate the file extension but also allow multiple file extensions if necessary. It also needs to be case insensitive. Basically, what I want is to...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
5
by: Ryan | last post by:
HELLO I am using the following MICROSOFT SUGGESTED (somewhere on msdn) regular expression to validate email addresses however I understand that the RFP allows for "+" symbols in the email address...
14
by: Andy B | last post by:
I need to create a regular expression that will match a 5 digit number, a space and then anything up to but not including the next closing html tag. Here is an example: <startTag>55555 any...
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...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.