"#max(([0-9]{1,3}),(\s)?([0-9]{1,3})(,(\s)?[0-9]{1,3})?)#"
That should work....
Yes... yes it does work.....
$strings = array('max(23, 54)', 'max(157,72,83)', 'max(22,15, 0)');
$pattern = "#max\(([0-9]{1,3}),(\s)?([0-9]{1,3})(,(\s)?[0-9]{1,3})?\)#";
foreach($strings as $string)
{
if(preg_match($pattern, $string))
{
echo '<span style="color: #00f;"><b>Match Found!!</b></span> <i>'.$string.'</i><br />';
}
else
{
echo '<span style="color: #f00;"><b>No Match!!</b></span> <i>'.$string.'</i><br />';
}
}
The only limitation is the size of the numbers. Right now they are 3 digit numbers (0 - 999). If you need larger than 1000, just edit where I have "{1,3}" to be "{1,X}" where X is the length of the number (4 integers (2195), 7 integers (4281052)).
~Brett