Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add RegEx for dynamic filterrules #2242

Closed
8 tasks done
j-lakeman opened this issue Sep 3, 2022 · 9 comments
Closed
8 tasks done

[Feature request] Add RegEx for dynamic filterrules #2242

j-lakeman opened this issue Sep 3, 2022 · 9 comments
Labels
declined declined enhancement New feature or request

Comments

@j-lakeman
Copy link

Prerequisites

I tried to reproduce the issue when...

  • uBO is the only extension
  • uBO with default lists/settings
  • using a new, unmodified browser profile

Description

I have JavaScript blocking enabled, but wish to be able to deactivate it for a range of webpages, e. g. all with the string "git" in them. I really appreciate the regex function in the exception rules section and would like to have something comparable for the dynamic rules section.

A specific URL where the issue occurs

https://github.com/

Steps to Reproduce

lorem ipsum

Expected behavior

Being able to use regex like no-scripting: /^.git./ false

Actual behavior

no-scripting: github.com false
no-scripting: gitlab.com false

uBlock Origin version

1.44.0

Browser name and version

Firefox 104.0.1 (64-Bit)

Operating System and version

macOS Big Sur 11.6.8

@Yuki2718
Copy link

Yuki2718 commented Sep 3, 2022

I tend to wish if it supported entity filter i.e. * www.example.* * noop. This will save lots of adjustment for rapidly changing movie sites. The regex in dynamic rule, however, will be in most cases not tokenizable as in the example, and also it's kinda against the spirit of the feature - the suggested rule allows githiimamalwaresite .com too.

@j-lakeman
Copy link
Author

Yeah sounds fair

@gwarser gwarser added the enhancement New feature or request label Sep 3, 2022
@gorhill
Copy link
Member

gorhill commented Sep 3, 2022

There is no tokenization taking place in dynamic filtering rules, it's all lookup tables using hostnames as keys, hence why it's fast compared to static filtering -- and using lookup tables means no possibility of regex or wildcard. I do not intend to change this.

@gorhill gorhill added the declined declined label Sep 3, 2022
@j-lakeman
Copy link
Author

Aight thx for clarifying

@Yuki2718
Copy link

Yuki2718 commented Sep 3, 2022

Forgive me for thought experiment. Will this be too much code change to add a user-editable variable, say, ? (whatever simbol but to distinguish from wildcard).

  1. User defines what TLDs he wants to include into ? e.g. ?-means: app,buzz,com
  2. Whenever user create a rule with ? manually via dynamic rules pane, uBO internally translates to rules of all these TLDs i.e.
* * www.example.app * noop
* * www.example.buzz * noop
* * www.example.com * noop

but in the pane it shows as * www.example.? * noop Too many use of this will cause high RAM usage as the actual numbers of rules diverge (particularly example1.? example2.? * noop) but those who use this are expected to be sensible. It's impossible to incorporate all the public suffix but those TLDs used by rapid-changing sites are limited. Once you have defined most of TLDs actually used, it frees up the needs for regular adjustment to some extent.

@gorhill
Copy link
Member

gorhill commented Sep 3, 2022

Will this be too much code change to add a user-editable variable

Yes.

The purpose of dynamic filtering is not to converge toward static filtering capabilities; the purpose is to be a point-and-click way to add/remove hostname-based firewall-like rules. Any sort of syntax for which there are no point-and-click user interface is not a good fit for dynamic filtering, that falls into static filtering realm. Beside, proposing complications like this should always, always come with real world cases to support such propositions. When you start to look at real world cases, I highly doubt they will prove to be valid use cases.

@Yuki2718
Copy link

Yuki2718 commented Sep 3, 2022

I highly doubt they will prove to be valid use cases.

I meant e.g. kisscartoon.*, kissanime.*, and all similar sites which regularly change TLDs but okay, thx for taking time.

@gorhill
Copy link
Member

gorhill commented Sep 3, 2022

I meant e.g. kisscartoon.*, kissanime.*

People visit specific ones, so they will point-and-click for the one they end up visiting. An actual use case would go in details to show why it's really tedious for dynamic filtering users to point-and-click on the kisscartoon sites they happen to visit. I highly doubt someone would complain that they need the feature because they visited 10 kisscartoon sites and had to set the same set of rules, and if so, I would advise them that since they are willing to manually create rules, might as well use static filtering with a filter such as ...$domain=kisscartoon.*,denyallow=.... There is just no convincing actual and detailed use cases being made to justify the amount of work requested from others.

I gather that if people who request such features would have to do the actual work themselves to implement it while also able to apprehend the sprawling complications to the point-and-click user interface, the performance implications, and the future workload of merely maintaining all that new code, they would realize the task of managing a few dynamic rules with the current implementation is completely trivial in comparison.

@gwarser
Copy link

gwarser commented Dec 30, 2024

Duplicate of #439

@gwarser gwarser marked this as a duplicate of #439 Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
declined declined enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants