Hi all!
I'm new here!
I was wondering how I can check if a string contains only "A-Za-z0-9_" and ".".
I tried the following code
[php]
function check_validstring($check_validstring)
{
if(eregi('[A-Za-z0-9_.]',$check_validstring))
{
return true;
}
else
{
return false;
}
[/php]
The result is:
When $check_validstring = 'aaa' it passed.
When $check_validstring = '@@' it failed.
But When $check_validstring = 'aaa@@' it passed.
Any way to prevent this? Thanks!