Skip to content

$replace cannot replace dollar ($) sign #3755

Description

@peace2000

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is NOT a YouTube, Facebook or Twitch report. These sites MUST be reported by clicking their respective links.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

$replace filter cannot replace dollar ($) sign if targeted directly. It can be workarounded by using . (any character in regex) instead of $ but it could be a bit inaccurate way to match and replace something...

Also, if dollar sign is being used as a part of a string to match, nothing will be matched (or replaced). It just breaks the filter.

A specific URL where the issue occurs.

https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-e43198c9c229.js

Steps to Reproduce

  1. Test filters:
    ||github.githubassets.com/*relative-time-element*js$replace=/\$/Test/g
    or
    ||github.githubassets.com/*relative-time-element*js$replace=/\${s}Display/Test/
  2. Open the URL to notice that no replacement was done.

Expected behavior

Dollar sign would have been replaced.

Actual behavior

Nothing was replaced.

uBO version

1.65.1b2

Browser name and version

FF 141.0.3

Operating System and version

Win 10

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions