By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

More Regex

P: n/a
Hi

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

Mar 1 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
..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/referen...ern.syntax.php

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

Micha
Mar 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.