Good day, I need to find with a regular expression all matching elements in an array using PHP, but I have a bug.
<?php
$a[0]='user@mail.ru';
$a[1]='112233@mail.domen';
$a[2]='ru@mail.user';
$a[3]='___@.user';
$pattern = '[a-z_0-9]+@[a-z]*.[a-z]{2,}';
for ($i=0;$i<=3;++$i)
{
if(preg_match($pattern,$a[i]))
{
echo $a[i];
}
}
Warning: preg_match() [function.preg-match]: Unknown modifier ‘+’ in {path to file} on line 9
Thanks.
You can try this-