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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combine regular expressions

Status
Not open for further replies.

TMac42

Programmer
Jul 24, 2000
83
US
I have a long list of regular expressions for various form fields I'm checking. My question is, if I want to apply two or more of these RE's to one of these fields, how do I go about doing that? Thanks.
 
Well... probably best to nest them (without knowing anything more about the scenario)...

Code:
if (regExp1.test(myString) && regExp2.test(myString)) {
// both regexp patterns returned true
} else {
// one (or both) regexp patterns returned false
}

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top