|
Posted by Schraalhans Keukenmeester on 05/14/07 20:32
At Mon, 14 May 2007 13:20:26 -0700, dr_phill123 let his monkeys type:
> The following code gives this warning, any suggestions?
>
> Warning: preg_match(): Compilation failed: nothing to repeat at
> offset 0 in test.php on line 6
>
> =========================
>
> $match = '* Hello World';
> $test = '* Hello';
>
> if ( preg_match ( "/$match/", $test ) ) echo "Matched";
Escape the * (\*) so it loses it's special meaning inside the regex.
Sh.
Navigation:
[Reply to this message]
|