Search code examples
syntaxadblockbrowser-addons

How can I use a wildcard in uBlock Origin?


How can I use a wildcard in uBlock Origin? I've tried to figure out how to do it, but I'm a little bit confused. I just want to simplify all of these rules into one rule:

www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(2)
www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(3)
www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(4)
www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(5)
www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(6)
www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(7)
www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(9)
www.dailymail.co.uk###js-article-text > div:nth-of-type(2) > div:nth-of-type(10)

Is it possible to give a range of numbers, or a list of specific numbers, or simply an asterisk? Thanks!


Solution

  • You can use 'odd' and 'even' as placeholders:

    www.dailymail.co.uk###js-article-text > div:nth-of-type(even) > div:nth-of-type(even)
    www.dailymail.co.uk###js-article-text > div:nth-of-type(even) > div:nth-of-type(odd)
    

    See https://www.w3schools.com/cssref/sel_nth-of-type.asp