Gerard Samuel a écrit:
Curt Zirzow wrote:
Gerard Samuel <[EMAIL PROTECTED]> wrote:
or even
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar .
'}$/', $some_string)
I think, you Forgot, a \ before the $ at the end of the expression...
that should work.
Unfortunately it doesn'
Curt Zirzow wrote:
Gerard Samuel <[EMAIL PROTECTED]> wrote:
or even
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/',
$some_string)
that should work.
Unfortunately it doesn't for some reason. Don't know why.
but you could do this:
$pattern = "/^[a-z0-9\-_\.]+\.[a-z
Gerard Samuel <[EMAIL PROTECTED]> wrote:
> 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)
You have single quotes, so php wont expand the variables inside.
>
> or even
> pre
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
4 matches
Mail list logo