AdguardBrowserExtension icon indicating copy to clipboard operation
AdguardBrowserExtension copied to clipboard

`$replace` rules with comma work incorrectly

Open AdamWr opened this issue 1 year ago • 1 comments

Please answer the following questions for yourself before submitting an issue

  • [X] Filters were updated before reproducing an issue
  • [X] I checked the knowledge base and found no answer
  • [X] I checked to make sure that this issue has not already been filed

AdGuard Extension version

4.4.30

Browser version

Firefox

OS version

Windows 11

Ad Blocking

AdGuard Base filter

Privacy

No response

Social

No response

Annoyances

No response

Security

No response

Other

No response

Language-specific

No response

What Tracking protection options do you have enabled?

No response

Issue Details

Steps to reproduce:

  1. Add this rule:
||example.org^$replace=/Example Domain/Example\, Domain/
  1. Go to - https://example.org/

Expected Behavior

Content should be modified to:

Example, Domain

Actual Behavior

Content is modified to:

Example\, Domain

Screenshots

Screenshot extension Firefox

image

Additional Information

According to documentation, a comma , should be escaped in $replace rules and if it's not escaped then rule is not applied. The problem is that \ is added to the content but should not be and in the app it is not.

Screenshot app for Windows

image

https://adguard.com/kb/general/ad-filtering/create-own-filters/#replace-modifier

In the $replace value, two characters must be escaped: comma , and dollar sign $. Use backslash \ for it. For example, an escaped comma looks like this: \,.

AdamWr avatar Oct 30 '24 11:10 AdamWr

$replace rules with comma work incorrectly

...or don't work completely. Example:

Not work:

||example.org^$replace=/Example \w{4,6}/Fix Me!/ ||example.org^$replace=/Example \w{4\,6}/Fix Me!/

But works:

||example.org^$replace=/Example \w{6}/Fix Me!/

XX-J avatar Jan 23 '25 12:01 XX-J