adblock-rust icon indicating copy to clipboard operation
adblock-rust copied to clipboard

Support for wildcards in Custom filters

Open buzaro opened this issue 11 months ago • 5 comments

*##+js(filter) // not working in brave shields , but working in ublock origin

please add support for wildcard it is important feature...

buzaro avatar Jan 02 '26 17:01 buzaro

*##+js(filter) // not working in brave shields , but working in ublock origin

please add support for wildcard it is important feature...

Hi @buzaro, thanks for reporting this! To better understand and implement wildcard support for custom filters, could you please clarify a few details:

  1. Which wildcard patterns are you trying to use?

    • * (asterisk for any characters)
    • ? (question mark for single character)
    • Regex patterns like /pattern/
    • Or something else?
  2. Can you provide a concrete example filter that works in uBlock Origin but not in Brave Shields? For example: What should this filter do? Are there specific websites where you tested this?

  3. Is this for procedural filters (cosmetic filters) or network filters?

  4. Are you using the standard uBlock Origin syntax? Reference: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters

This will help in prioritize and implement the feature correctly. I saw some related issues tracked:

  • #194 - Wildcard TLD domains (entity matching)
  • #415 - ABP syntax with inline CSS/Remove (includes * wildcards)

Any additional details or test cases would be very helpful!

R0h1tAnand avatar Jan 10 '26 18:01 R0h1tAnand

*##+js(filter) // not working in brave shields , but working in ublock origin please add support for wildcard it is important feature...

Hi @buzaro, thanks for reporting this! To better understand and implement wildcard support for custom filters, could you please clarify a few details:

1. **Which wildcard patterns are you trying to use?**
   
   * `*` (asterisk for any characters)
   * `?` (question mark for single character)
   * Regex patterns like `/pattern/`
   * Or something else?

2. **Can you provide a concrete example filter that works in uBlock Origin but not in Brave Shields?**
   For example:
   What should this filter do? Are there specific websites where you tested this?

3. **Is this for procedural filters (cosmetic filters) or network filters?**

4. **Are you using the standard uBlock Origin syntax?**
   Reference: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters

This will help in prioritize and implement the feature correctly. I saw some related issues tracked:

* [Wildcard TLD domains ("entity" matching) #194](https://github.com/brave/adblock-rust/issues/194) - Wildcard TLD domains (entity matching)

* [Support for the new ABP syntax `Inline CSS` and `Remove` #415](https://github.com/brave/adblock-rust/issues/415) - ABP syntax with inline CSS/Remove (includes `*` wildcards)

Any additional details or test cases would be very helpful!

hey @R0h1tAnand thanks for replying

  1. Which wildcard patterns are you trying to use?
  • * (asterisk for any characters)
  1. Can you provide a concrete example filter that works in uBlock Origin but not in Brave Shields?

so in ublock origin if you use this rule *##+js(custom-filter.js) than this rule will work for every domain , subdomain basically everywhere . But if you use same rule *##+js(custom-filter.js) in brave shields than this will not work instead you have to specify every domain name manually , like : example.com,google.com,facebook.com##+js(custom-filter.js).

For example i have a custom scriptlet which will allow me to use right click if website blocks it , i want this scriptlet to apply it everywhere but as wildcard feature is not there in brave shields i have to specify domain manually every time.

It's also very useful if someone don't want any images in any website they could use this filter: *##img which will block img tag on all domains.

  1. Is this for procedural filters (cosmetic filters) or network filters?

procedural filters

  1. Are you using the standard uBlock Origin syntax?

yes

One more similar issue exist in brave-browser repo : https://github.com/brave/brave-browser/issues/45839

buzaro avatar Jan 11 '26 06:01 buzaro

I tried to use this in an up-to-date Brave and it didn't work, so I'm guessing it is not implemented yet?

But the current state is a bit confusing for me. Some places indicates that it is implemented and... not, at the same time 🤔 ?

I care about this, so if you could provide an update on the current state and some guidance on pending work, I might be able to help.

marcelocra avatar Sep 02 '26 17:09 marcelocra

I ran into the same issue on Brave Android. Generic cosmetic filters like ##*:style(...) and *## *:style(...) still don't work for me in the current version. I also found the closed #586 PR and the reopened #582 issue, so I'm equally unsure about the current implementation status.

ghost avatar Sep 05 '26 12:09 ghost

Bruh, I'm a fking idiot... By writing, for example: net,org,com##*:style(font-weight: bold !important;) this affects all domains ending in these TLDs (Top-Level Domains).

ghost avatar Sep 06 '26 09:09 ghost