Hi there. I have the following php code:
<?php
echo 'starting regex test<BR>';
$data = "c799 1 000ffe-fcc811 1 000ffe-fcc86f 1 000ffe-fcc898 1 000ffe-fcc92d 1 000ffe-fcc934 1 000ffe-fcc965 1 000ffe-fcc96b";
$pattern="/([a-fA-F0-9]){6}-([a-fa-fA-F0-9]){6}$/i";
echo "the pattern we are using is:".$pattern."<BR>";
if (preg_match($pattern,$data))
{
$matches = preg_match($pattern,$data, $matches);
echo 'Matches we found:'. print_r($matches, true);
} else {
echo "No, the mac address is wrong";
}
?>
I'm just wondering why it only finds one match....
also, what is the proper way to define a hex value in regular expressions?
thank you.