More Regex

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

And what does the ! do . Cant find anything info about that.

any help would be appreciated

Re: More Regex


Quoted text here. Click to load it

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.

So the regex above matches all src=", that are not followed by http://.


Site Timeline