string pattern for ereg function
Moderator: General Moderators
-
bugthefixer
- Forum Contributor
- Posts: 118
- Joined: Mon Mar 22, 2004 2:35 am
string pattern for ereg function
any1 can tel me string pattern for ereg function which accept small and capital alphabets and a blank space
Why not try it yourself by reading the manual at http://www.php.net, then, if you get stuck, come back with the code you have written and we will help you.
Mark
Mark
-
bugthefixer
- Forum Contributor
- Posts: 118
- Joined: Mon Mar 22, 2004 2:35 am
i hav tried
the code i used was
it recognizes alphabets but not spaces..kan u tel me y
Code: Select all
<?php
ereg("^[a-zA-Z\s]+$",$str)
?>\s is not recoginsed as having any special meaning with POSIX Extended regex.
You could use either..
or..
You could use either..
Code: Select all
ereg("^[a-zA-Z[]]+$",$str)Code: Select all
ereg("^[a-zA-Z ]+$",$str)
// space after the Z