Page 1 of 1

Using Regular Expressions to remove portions of page source

Posted: Wed Oct 17, 2007 4:09 am
by RandomBlogger
Ok, I'm pretty sure there's no way to do this with Adblock Plus, but I figure it doesn't hurt to ask.

What I am trying to do is have all instances of a certain regular expression removed from the page source. I'm aware of element hiding, but element hiding doesn't quite get me what I need, since I'm not able to make conditions on the content outside of the element declaration.

For example, what I want to block looks like this:
<div class="message"><img src="asdf.jpg" alt="blah" />blah blah blah</div>
But I don't want to block all elements of class "message," just the ones that have an image with alt="blah". I've got a regular expression that finds the content consistently, but Adblock only seems to apply regular expressions to the URL.

Is there any way to do this with Adblock Plus? If not, does anyone know of any other extension that allows this sort of thing?

Thanks!

Posted: Wed Oct 17, 2007 5:12 am
by Peng
You can run a local proxy program like, erm, Proxomitron, or that other one.

Re: Using Regular Expressions to remove portions of page sou

Posted: Fri Oct 19, 2007 8:44 pm
by JDlugosz
RandomBlogger wrote: If not, does anyone know of any other extension that allows this sort of thing?

Thanks!
Yes in deed! Do it with Greasemonkey.
You can specify that rule as an XPATH expression, and delete the element you found, render it invisible, replace it with something else, or whatever.

Posted: Mon Oct 22, 2007 10:19 am
by Peng
If it's XPATH, isn't that what Remove It Permanently for?

Posted: Mon Oct 29, 2007 11:18 pm
by cuzz