Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

match a pattern

Status
Not open for further replies.

jewel464g

Technical User
Jul 18, 2001
198
US
I know this can be done with regular expressions, but my knowledge of regular expressions stinks. I need to say

if (request.form("claim_num") is of the format: "2 numbers – 4 numbers – 3 numbers"
then go here
else go there.

Can some please help me out with how to do that?
Jewels



When faced with a decision, always ask, 'Which would be the most fun?'
 
One of the articles I generally point people to is a 4guysFromRolla article, here:
Personally I think every programmer should get an idea on how to use regular expressions beyond the one-off use, as they are extremely handy in a number of situations.

If you read through the 2 page article you will actually find a n example similar to the pattern you want to build on the second page. between the previous content and that pattern you should be able to formulate one on your own.

Let us know if you read through that article and still feel lost or need some assistance validating your expression,

-T

 
Let me give this a shot, as I need practice on regex's.
Code:
if (request.form("claim_num").test(/^\d{2}-\d{4}-\d{3}$/)) {


}
else {


}

<.

 
I think you forgot a language warning on that one :)

 
[surprise]

*Language warning: Done with ASP JScript

There, how about that?

[afro]

<.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top