Unfully support for Regular Expression

Everything about using Adblock Plus on Mozilla Firefox, Thunderbird and SeaMonkey
Post Reply
CrendKing
Posts: 2
Joined: Sun Aug 12, 2007 4:43 pm

Unfully support for Regular Expression

Post 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!
Alan
Posts: 289
Joined: Sat Feb 10, 2007 8:47 pm
Location: Colorado, USA

Post 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?
CrendKing
Posts: 2
Joined: Sun Aug 12, 2007 4:43 pm

Post 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?
Alan
Posts: 289
Joined: Sat Feb 10, 2007 8:47 pm
Location: Colorado, USA

Post 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.
User avatar
chewey
Posts: 501
Joined: Wed Jun 14, 2006 10:34 pm
Location: somewhere in Europe

Post 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
Post Reply