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

Add support for $removeparam modifier #41

Closed
slavaleleka opened this issue May 28, 2021 · 9 comments
Closed

Add support for $removeparam modifier #41

slavaleleka opened this issue May 28, 2021 · 9 comments

Comments

@slavaleleka
Copy link
Contributor

example 1
$removeparam=_openstat
$removeparam=action_object_map
$removeparam=action_ref_map
$removeparam=utm_content

Screenshot 1

example 2
||app.mi.com/download/*?id=$removeparam=ref
||mp.weixin.qq.com^$removeparam=pass_ticket
||visit.digidip.net^$removeparam=/^(ppref|ref|pid)=/
||mvideo.ru^$removeparam=/^(_requestid|reff)=/

Screenshot 2

@bogachenko
Copy link

Hi @ameshkov, is this a bug? The ADGfW program does not allow creating a regexp with repetitions. The {2,4} construction does not work for this modifier, everything after the comma causes an error. I can only create {2}, why?
eg. $removeparam=/ref(err?al)?([a-zA-Z0-9]{2,3})?[_=]/ or $removeparam=/test[1-9]{2,4}/

@Alex-302
Copy link
Member

Try with escaped comma - {2\,4}

@bogachenko
Copy link

bogachenko commented Sep 15, 2024

Yes, it works. But why should this be written, because it completely breaks the regexp markup.
It's also not on your wiki.
In addition, this will not work in the Frenchy's extension, since the markup there corresponds to the standard.

@Alex-302
Copy link
Member

@bogachenko
Copy link

bogachenko commented Sep 16, 2024

That's not what I was talking about, I don't understand why you're answering the question that I didn't ask.

As far as I can tell, the ADG program was universal. The program has its own sheets, but she tries to maintain the sheets and the Frenchy's achievements. There is a clear algorithm for regexps, it does not differ, and this is the standard when the number of repetitions and the "comma" symbol are wrapped in curly brackets, there can be no extraneous characters in it and the link that you gave does not apply to my question, since it says about the non-wrapped "comma" sign.

In other words, as I said, edits have been made to the markup of the regex for the program, it differs from the standard, but there is no word about this in the wiki, plus support from the Frenchy sheets will be broken.

@bogachenko
Copy link

bogachenko commented Sep 16, 2024

In regular regexp not with the removeparam modifier, a comma with a slash in wrapped brackets breaks the rule of regexps. For example, go to https://ya.ru/ and try to block it one at a time:

  1. /\/nova\/[0-9a-z]{7\,8}/$image - doesn't work
  2. /\/nova\/[0-9a-z]{7,8}/$image - works

You have a bug in the program, just admit it. The program with a modifier cannot respond to a regular expression in one way - ok, and without a modifier - in another way - not ok. It's just wrong, and it disrupts the program.

@scripthunter7
Copy link
Member

scripthunter7 commented Sep 16, 2024

@bogachenko This is not a bug, it is simply a limitation of the current syntax (dollar sign and comma are special characters in adblock syntax and used for modifier list). There are plans in the near future to eliminate the need for extra escapes in regexps to prevent misunderstandings.

Reference: AdguardTeam/tsurlfilter#121

@slavaleleka
Copy link
Contributor Author

It's also not on your wiki.

special character escaping for $removeparam is actually mentioned in the kb:
https://uploads.adguard.org/slGBfPXuJS31USt5Ez.png
https://adguard.com/kb/general/ad-filtering/create-own-filters/#removeparam-modifier

@bogachenko
Copy link

bogachenko commented Sep 17, 2024

It's also not on your wiki.

special character escaping for $removeparam is actually mentioned in the kb: https://uploads.adguard.org/slGBfPXuJS31USt5Ez.png https://adguard.com/kb/general/ad-filtering/create-own-filters/#removeparam-modifier

I was talking about a wrapped special sign, not a regular one. I chose standard regex markup as a basis, if I'm talking about wrapped, then I'm looking for what's written in the wiki for wrapped signs and of course I know that the usual ones are excluded by the backslash character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants