Search:
Namespaces
Discussions
.NET v1.1
Feedback
help on regexp!
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngregexp' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Matias Woloski
Hi! I have to test some phones entered into a textarea. So for example
someone enter this:
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
What I want to check is that the user enter a valid phone with this regex
((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}
but also I want to check that the number of phones entered to be <= 10
between phones there are Enters
so this is correct
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
but this not
<textarea>
(123) 233222 <-- not valid phone
(124) 2334-1222
</textarea>
this is not correct
<textarea>
valid phone 1
valid phone 2
valid phone 3
valid phone 4
...
valid phone 10
valid phone 11 <-- there must be 10 phones only!
</textarea>
thanks in advance,
Matias
Reply to this message...
dagon
Basically,
^(((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}(\r?\n)?){1,10}$
-----Original Message-----
From: Matias Woloski [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, November 04, 2001 00:16
To: aspngregexp
Subject: [aspngregexp] help on regexp!
Hi! I have to test some phones entered into a textarea. So for example
someone enter this:
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
What I want to check is that the user enter a valid phone with this regex
((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}
but also I want to check that the number of phones entered to be <= 10
between phones there are Enters
so this is correct
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
but this not
<textarea>
(123) 233222 <-- not valid phone
(124) 2334-1222
</textarea>
this is not correct
<textarea>
valid phone 1
valid phone 2
valid phone 3
valid phone 4
...
valid phone 10
valid phone 11 <-- there must be 10 phones only!
</textarea>
thanks in advance,
Matias
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
dagon
Oops, that would allow "(123) 2334-1222(123) 2334-1222" for example because
of the conditional \r\n, you want:
^(((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}(\r?\n|$)){1,10}
-----Original Message-----
From: dagon [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, November 04, 2001 01:26
To: aspngregexp
Subject: [aspngregexp] RE: help on regexp!
Basically,
^(((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}(\r?\n)?){1,10}$
-----Original Message-----
From: Matias Woloski [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, November 04, 2001 00:16
To: aspngregexp
Subject: [aspngregexp] help on regexp!
Hi! I have to test some phones entered into a textarea. So for example
someone enter this:
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
What I want to check is that the user enter a valid phone with this regex
((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}
but also I want to check that the number of phones entered to be <= 10
between phones there are Enters
so this is correct
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
but this not
<textarea>
(123) 233222 <-- not valid phone
(124) 2334-1222
</textarea>
this is not correct
<textarea>
valid phone 1
valid phone 2
valid phone 3
valid phone 4
...
valid phone 10
valid phone 11 <-- there must be 10 phones only!
</textarea>
thanks in advance,
Matias
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Matias Woloski
that worked excelent!!! thanks dagon!
Do you have some tool to work with Reg Exps? (I saw a software Visual
RegExp, but it was for Linux)
thanks again!
Matias
-----Original Message-----
From: dagon [mailto:
Click here to reveal e-mail address
]
Sent: sábado, 03 de noviembre de 2001 20:43
To: aspngregexp
Subject: [aspngregexp] RE: help on regexp!
Oops, that would allow "(123) 2334-1222(123) 2334-1222" for example because
of the conditional \r\n, you want:
^(((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}(\r?\n|$)){1,10}
-----Original Message-----
From: dagon [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, November 04, 2001 01:26
To: aspngregexp
Subject: [aspngregexp] RE: help on regexp!
Basically,
^(((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}(\r?\n)?){1,10}$
-----Original Message-----
From: Matias Woloski [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, November 04, 2001 00:16
To: aspngregexp
Subject: [aspngregexp] help on regexp!
Hi! I have to test some phones entered into a textarea. So for example
someone enter this:
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
What I want to check is that the user enter a valid phone with this regex
((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}
but also I want to check that the number of phones entered to be <= 10
between phones there are Enters
so this is correct
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
but this not
<textarea>
(123) 233222 <-- not valid phone
(124) 2334-1222
</textarea>
this is not correct
<textarea>
valid phone 1
valid phone 2
valid phone 3
valid phone 4
...
valid phone 10
valid phone 11 <-- there must be 10 phones only!
</textarea>
thanks in advance,
Matias
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Steven A Smith (VIP)
You can use
http://regexlib.com/
which will let you search for and test
regular expressions.
Steve
Steven Smith
Click here to reveal e-mail address
President, ASPAlliance.com
http://aspalliance.com
The #1 ASP.NET Community
http://aspsmith.com
ASP.NET Training for ASP Developers
Get The Book: ASP.NET By Example
http://www.amazon.com/exec/obidos/ASIN/0789725622/stevenatorasp/
----- Original Message -----
From: "Matias Woloski" <
Click here to reveal e-mail address
>
To: "aspngregexp" <
Click here to reveal e-mail address
>
Sent: Sunday, November 04, 2001 9:44 PM
Subject: [aspngregexp] RE: help on regexp!
[Original message clipped]
Reply to this message...
dagon
Visual RegExp? That sounds terrible.. what do you do, drag and drop
expressions? :).
I don't work with any special tools for RegExps, I use my good old reliable
code editor, after a few years of RegExping that way it comes as natural as
any other piece of code.
Anyway, I'm glad it worked out for you and you're welcome :).
-----Original Message-----
From: Matias Woloski [mailto:
Click here to reveal e-mail address
]
Sent: Monday, November 05, 2001 04:45
To: aspngregexp
Subject: [aspngregexp] RE: help on regexp!
that worked excelent!!! thanks dagon!
Do you have some tool to work with Reg Exps? (I saw a software Visual
RegExp, but it was for Linux)
thanks again!
Matias
-----Original Message-----
From: dagon [mailto:
Click here to reveal e-mail address
]
Sent: sábado, 03 de noviembre de 2001 20:43
To: aspngregexp
Subject: [aspngregexp] RE: help on regexp!
Oops, that would allow "(123) 2334-1222(123) 2334-1222" for example because
of the conditional \r\n, you want:
^(((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}(\r?\n|$)){1,10}
-----Original Message-----
From: dagon [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, November 04, 2001 01:26
To: aspngregexp
Subject: [aspngregexp] RE: help on regexp!
Basically,
^(((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}(\r?\n)?){1,10}$
-----Original Message-----
From: Matias Woloski [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, November 04, 2001 00:16
To: aspngregexp
Subject: [aspngregexp] help on regexp!
Hi! I have to test some phones entered into a textarea. So for example
someone enter this:
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
What I want to check is that the user enter a valid phone with this regex
((\(\d{3}\) ?)|(\d{3}-))?\d{4}-\d{4}
but also I want to check that the number of phones entered to be <= 10
between phones there are Enters
so this is correct
<textarea>
(123) 2334-1222
(124) 2334-1222
</textarea>
but this not
<textarea>
(123) 233222 <-- not valid phone
(124) 2334-1222
</textarea>
this is not correct
<textarea>
valid phone 1
valid phone 2
valid phone 3
valid phone 4
...
valid phone 10
valid phone 11 <-- there must be 10 phones only!
</textarea>
thanks in advance,
Matias
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com