ereg("[a-z]*",$input)
First of all, I suggest you change to preg_match. PERL Compatible regexps. Those are documented all over the place, in any PERL script/site/thingamedoodle.
Second, your regexp ,means the following:
^ = start of string
[a-z] = a through z
* = zero or more times
There isn't a string on this planet that does not start with zero or more instances of a-z. 🙂
What you want is to make sure that the entire string, from beginning to end, is made up of a-z.
So at the very least you need
$
which means 'beginning of string''end of string'
Inbetween you want a-z:
[a-z]$
but you want more than one occurence, in fact you want one or more (one or more, because an empty string is not made up of only a-z)
[a-z]+$
stick that in a preg_match (the slashes define the pattern, the are not part of the pattern):
$sString = 'hello';
if (!preg_match("/[a-z]+$/", $sString))
{
echo 'no match';
}
else
{
echo 'match';
}
A forum, a FAQ, what else do you need?