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

Regular expression examples

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Can you give me some of the examples of regular expression, and its function
 
check devedge.netscape.com

they have lots of info. luciddream@subdimension.com
 
regular expressions in javascript:

some excerpts from
two ways to create one
1) var daRegExp=new RegExp("pattern","switch")
2) (the more used) var daRegExp=/pattern/switch


then you would use it like this:

if (daRegExp.test(5)){ /*do stuff if it matches*/ } else
{ /*do stuff if it doesnt match*/}


I suppose now you are wondering what pattern and switch represent now?

pattern: there are many different ways to validate a string with a regExp. The best table is at this site: .
I would explain it here, but it would take to long.

switch: there are three, optional switches:
g,i, and gi.

g stands for global search, and i stands for ignore case. gi then stands for global search, ignoring case.

I am not going to go into syntax, if you want that, check the website.


P.S. - email me, I have a question for you.
theEclipse
eclipse_web@hotmail.com
**\\||It was recently discovered that research causes cancer in rats||//**
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top