Skip to content
The Chat Archive
gpt-4.1-mini-2025-04-14· OpenAI LMArena Human Preference 140K

How can I turn these ublock origin filters into a wildcard filter? (notice the pattern)…

  1. User

    How can I turn these ublock origin filters into a wildcard filter? (notice the pattern)

    mydramalist.com##.mjfqj2529 mydramalist.com##.qzjmj2529 mydramalist.com##.qlmmj2529 mydramalist.com##.mcsfj2529 mydramalist.com##.rqmmj2529

  2. Assistant

    You want to convert these specific uBlock Origin filters targeting classes like .mjfqj2529, .qzjmj2529, etc., into a single wildcard filter that matches all similar patterns.


    Given filters:

    mydramalist.com##.mjfqj2529
    mydramalist.com##.qzjmj2529
    mydramalist.com##.qlmmj2529
    mydramalist.com##.mcsfj2529
    mydramalist.com##.rqmmj2529
    

    Observations:

    • All filters target classes on mydramalist.com.
    • All classes end with 2529.
    • The first 5 characters vary but seem to be random letters.
    • The pattern is: a 5-letter class name ending with 2529.

    How to write a wildcard filter for this pattern?

    uBlock Origin supports CSS selectors with attribute selectors and wildcards, but it does not support regex in CSS selectors. However, you can use CSS attribute selectors with ^= (starts with), $= (ends with), and *= (contains).

    Since these are class names, and class selectors in CSS cannot be partially matched easily, you can use the attribute selector for the class attribute:

    mydramalist.com##[class$="2529"]
    

    This will hide any element whose class attribute ends with "2529" on mydramalist.com.


    Important notes:

    • This will match any element with a class ending in 2529, even if the class is part of a longer list of classes.
    • If you want to be more specific and only target classes that are exactly 9 characters long (5 letters + 4 digits), CSS alone cannot enforce length, but this is usually sufficient.

    Final wildcard filter:

    mydramalist.com##[class$="2529"]
    

    If you want to be even more specific and only target elements whose class attribute contains a class ending with 2529 (not just the entire class attribute), you can try:

    mydramalist.com##:is([class*="2529"])
    

    But the first one is usually enough.


    If you want to target only classes that start with any 5 letters and end with 2529, but no other classes, uBlock Origin's CSS selector syntax is limited, so the above is the best practical approach.


    Summary:

    Replace your multiple filters with this single wildcard filter:

    mydramalist.com##[class$="2529"]
    

    This will block all elements with classes ending in 2529 on mydramalist.com.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.