Posted by Michael Fesser on 03/01/07 22:54
..oO(Damo)
>I was reading through someone else s code earlier and I came across
>this regex
>
>$regex = '%src="(?!http://)%';
>
>I cant figure out what it does. The ? is a greedy quantifier is it not
>and should be after http://............. or is that rubbish
The ? is used in many places for many different things. In combination
with a ! like in this case it's called a negative lookahead assertion.
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
So the regex above matches all src=", that are not followed by http://.
Micha
[Back to original message]
|