Page 1 of 1
Mixing regular expression and DIV
Posted: Thu Jul 08, 2010 8:17 pm
by Amy
Hi folks,
I am looking how to filter a full <div> bloc when its header does not contain an id="xxxx" but contains a specific class.
in example :
<div id="tralala" class="Class1 Class2"> .....</div> must not be filtered, while
<div class="Class1 Class2"> ...</div> must be.
I tested so many syntaxes that I am completely out of mind !
Does anyone can tell me if making a such filter is even possible ?
and how ....
Thank you very much for any help.
Amy
Re: Mixing regular expression and DIV
Posted: Thu Jul 08, 2010 9:28 pm
by Dr. Evil
This should do the trick:
Code: Select all
example.com##div.Class1.Class2:not(#tralala)
Re: Mixing regular expression and DIV
Posted: Fri Jul 09, 2010 2:10 pm
by Amy
Dr. Evil wrote:This should do the trick:
Code: Select all
example.com##div.Class1.Class2:not(#tralala)
Indeed ! Is there a place where these tricks are detaillled ? I searched through all the docs pages without find them.
In my case "tralala" is a variable number (from "p1" to "p99999"), I serched to use a regular expression, but it do not works.
I tried: example.com##div.Class1.Class2:not(#/p\d+/) and many syntax variants, without success (no matches, nothing removed).
Can a regular expression be included like that ?
Thank you
Amy
Re: Mixing regular expression and DIV
Posted: Sun Jul 11, 2010 5:05 pm
by Dr. Evil
Element Hiding Rules are really just CSS Selectors. A reference of all the selectors supported by Firefox can be found here:
https://developer.mozilla.org/en/css_re ... electors_2
There's no selector that matches an attribute (like ID) with a regular expression, so the only way to hide the element you're concerned with would be with the "starts with" attribute selector:
Code: Select all
example.com##div.Class1.Class2:not([id^="p"])
Or, in case the page has some ids starting with "p", you'll have to use this rule:
Code: Select all
example.com##div.Class1.Class2:not([id^="p1"]):not([id^="p2"]):not([id^="p3"]):not([id^="p4"]):not([id^="p5"]):not([id^="p6"]):not([id^="p7"]):not([id^="p8"]):not([id^="p9"])
Posted: Sat Jul 31, 2010 1:57 pm
by Amy
Hi,
Thank you very much, Dr.Evil, it is exactelly what I was looking for.
The second syntax is not required, because the two nested class is restrictive enough.
And thank you also for the link to the CSS reference page, it contains a lot of valuable infos !
Amy