Page 1 of 1

Unfully support for Regular Expression

Posted: Sun Aug 12, 2007 4:54 pm
by CrendKing
I want to block "abc/def.com", block "xyz/def.com" but not "img/def.com", i.e. I want to block any address when "img" is not preceding "/def.com".

I found this regular expression /(?<!img\/)def\.com/ could work. However, it is an invalid expression in Adblock Plus 0.7.5.1. Does Adblock Plus not fully support regular expression? Or there is any alternative expression could work? Thanks!

Posted: Sun Aug 12, 2007 6:08 pm
by Alan
The Adblock Plus documentation page at http://adblockplus.org/en/filters#regexps points to "check out documentation on regular expressions to learn how to write them" at http://developer.mozilla.org/en/docs/Co ... cts:RegExp

Does that help?

Posted: Sun Aug 12, 2007 6:18 pm
by CrendKing
Yes, I checked that document and found no rule about ?<!. However I think I may write an equivalent like /img(?!\/def\.com)/ , since Firefox support (?!expr) expression, right?

Posted: Sun Aug 12, 2007 6:24 pm
by Alan
CrendKing wrote:right?
I don't know. I'm not an expert. Put together something that does what you want and report back what it is. The experts might have alternatives.

Posted: Sun Aug 12, 2007 6:38 pm
by chewey
(?<!) is a "negative lookbehind" used in PCRE (i.e. Perl). Gecko's JS engine doesn't
support this operator, and since ABP relies on Gecko's JS capabilities, it doesn't either.

Yes, Gecko's JS supports (?!), but this won't help in this case.
The easiest way I see is to make it two rules:

Code: Select all

/def.com
@@img/def.com