cannot resolve spaces in regular expression

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

cannot resolve spaces in regular expression

Post by bugthefixer »

my code for matching regular expression is
ereg("^[a-zA-Z\s]$",$str);
so far is i know '\s' is used for matching spaces..but my program does not matches spaces but it does match small and capital alphabets..
wat cud be the problem..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you are matching only 1 character. add + after the ] should take care of it.
Post Reply