Forum Moderators: coopster

Message Too Old, No Replies

preg match() funcion

please give me some precise expression

         

camilord

2:44 pm on Feb 20, 2007 (gmt 0)

10+ Year Member



boss, can anybody give me a precise ereg expression which check only for:

1.) alphabets only
2.) for numeric only (includes "+" and "-")

thanks...

please don't post links.. thanks..

Scally_Ally

3:10 pm on Feb 20, 2007 (gmt 0)

10+ Year Member



check this link out

[uk.php.net...]

Scally_Ally

3:14 pm on Feb 20, 2007 (gmt 0)

10+ Year Member



sorry couldnt resist...
how about something like
preg_match('^[a-z,A-Z,0-9,+,-]i', $myString)
Im not that crash hot at regular expressions though (or comedy) and i havent tested
Ally

[edited by: Scally_Ally at 3:22 pm (utc) on Feb. 20, 2007]

Psychopsia

3:23 pm on Feb 20, 2007 (gmt 0)

10+ Year Member



> preg_match('/^[a-zA-Z0-9\+\-]$/i', $str)

camilord

5:35 pm on Feb 20, 2007 (gmt 0)

10+ Year Member



thanks..