Has anyone had any success with using variables in a regex shown below??

$foo = 3;
$bar = 4;
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}$/', $some_string)

or even
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/', $some_string)


but this would work
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{3,4}$/', $some_string)

Thanks for any pointers..


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to