Simeple Reg Exp Not working

M

MSDN

Hello,

Does anyone what RegExp to use for the following.

3-digits followed by "-" or " " then Followed by 6 or 7 digits then followed
by any number of spaces.

111 111111
111-111111

222-123456"" space at the end okay

231 1345678

I just can not figure out the end spaces...

Thank you

SA
 
K

Kevin Spencer

[\d]{3}[-\s]{1}[\d]{6,7}[ ]*

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.
 
M

MSDN

Kevin,

Thank you it is working know

SA


Kevin Spencer said:
[\d]{3}[-\s]{1}[\d]{6,7}[ ]*

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

MSDN said:
Hello,

Does anyone what RegExp to use for the following.

3-digits followed by "-" or " " then Followed by 6 or 7 digits then
followed
by any number of spaces.

111 111111
111-111111

222-123456"" space at the end okay

231 1345678

I just can not figure out the end spaces...

Thank you

SA
 
M

MSDN

Sorry I did not ask the right question
I ended using

^\d{3}[-| ]?\d{6}\d?[ ]?$

May be I could have used this also
\d{3}[- ]?\d{6}\d?[ ]+

So I want [3 digits ] [Followed by nothing or, - , or space ] [Followed by 6
digits][Followed by zero or one digit][Followed by zero or many spaces]

Again Thank you for your help

SA


Kevin Spencer said:
[\d]{3}[-\s]{1}[\d]{6,7}[ ]*

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

MSDN said:
Hello,

Does anyone what RegExp to use for the following.

3-digits followed by "-" or " " then Followed by 6 or 7 digits then
followed
by any number of spaces.

111 111111
111-111111

222-123456"" space at the end okay

231 1345678

I just can not figure out the end spaces...

Thank you

SA
 
K

Kevin Spencer

So, you're all set then?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

MSDN said:
Sorry I did not ask the right question
I ended using

^\d{3}[-| ]?\d{6}\d?[ ]?$

May be I could have used this also
\d{3}[- ]?\d{6}\d?[ ]+

So I want [3 digits ] [Followed by nothing or, - , or space ] [Followed by
6 digits][Followed by zero or one digit][Followed by zero or many spaces]

Again Thank you for your help

SA


Kevin Spencer said:
[\d]{3}[-\s]{1}[\d]{6,7}[ ]*

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

MSDN said:
Hello,

Does anyone what RegExp to use for the following.

3-digits followed by "-" or " " then Followed by 6 or 7 digits then
followed
by any number of spaces.

111 111111
111-111111

222-123456"" space at the end okay

231 1345678

I just can not figure out the end spaces...

Thank you

SA
 
M

MSDN

Kevin,

Yes and thank you,

SA

Kevin Spencer said:
So, you're all set then?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

MSDN said:
Sorry I did not ask the right question
I ended using

^\d{3}[-| ]?\d{6}\d?[ ]?$

May be I could have used this also
\d{3}[- ]?\d{6}\d?[ ]+

So I want [3 digits ] [Followed by nothing or, - , or space ] [Followed
by 6 digits][Followed by zero or one digit][Followed by zero or many
spaces]

Again Thank you for your help

SA


Kevin Spencer said:
[\d]{3}[-\s]{1}[\d]{6,7}[ ]*

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

Hello,

Does anyone what RegExp to use for the following.

3-digits followed by "-" or " " then Followed by 6 or 7 digits then
followed
by any number of spaces.

111 111111
111-111111

222-123456"" space at the end okay

231 1345678

I just can not figure out the end spaces...

Thank you

SA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top