Re: Another preg_match() [function.preg-match]: Unknown modifier'{' ;-)
JanDoggen schreef:
> function vldLicense($lic)
> {
> echo "called with lic: ". $lic . "<br>";
> echo preg_match('[A-Za-z0-9]', $lic) . "<br>";
>
> if (preg_match('[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-
> z0-9]{4}', $lic) == 0) return false;
> return true;
> }
>
> gives me:
>
> called with lic: 64gd-kwey-t643-ytes
> 0
> Warning: preg_match() [function.preg-match]: Unknown modifier '{'
>
> Why the 0 in the simple match?
> Why the unknown modifier in the complex match?
>
In the first call, the square brackets are assumed to be modifiers. If
you would put something behind the character class (e.g.
'[A-Za-z0-9]a'), you will the same compliant pointing at the bracket.
JW
|