here is my code:
any help
Code: Select all
$regex="/^[a-zA-Z]([a-zA-Z0-9]*){5,26}$/";
$var = 'a';
if(preg_match($regex,$var))
{
echo "Hello";
}else
{
echo "yall";
}Moderator: General Moderators
Code: Select all
$regex="/^[a-zA-Z]([a-zA-Z0-9]*){5,26}$/";
$var = 'a';
if(preg_match($regex,$var))
{
echo "Hello";
}else
{
echo "yall";
}itsmani1 wrote:i want to check if the $var has minimum 5 characters and they are all of a-zA-Z0-9 and started with a-z but its not working.
Code: Select all
preg_match('/^[a-z][a-zA-Z0-9]{4,}$/D', $var);