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

(Search): Replacement string start with '$$' only have one '$' in effect #5486

Closed
Davidliu11 opened this issue Feb 22, 2024 · 2 comments
Closed

Comments

@Davidliu11
Copy link

Davidliu11 commented Feb 22, 2024

Describe the bug

When find and replace any string in the code, If I use string like '$$xxxx' as the replacement string then then result would be '$xxxx', only one '$' left.

Expected Behavior

Treat '$$xxxx' as a normal string, instead of a special replacement pattern.

Current Behavior

'$$' will be treated as a special replacement pattern.

Reproduction Steps

Use 'ctrl+f' to find and replace, and the replacement string start with double '$'

Possible Solution

Seems this is reasonable behavior for the "string.prototype.replace()", but this is assuming the user to know the internal implementation of the editor.

Additional Information/Context

No response

Ace Version / Browser / OS / Keyboard layout

v1.32.2, Chrome, Windows

@InspiredGuy
Copy link
Contributor

Thank you for the report. Indeed ace uses the regular String.prototype.replace, some extra logic would be required to make it work as expected.

replacement = input.replace(re, replacement);

@InspiredGuy
Copy link
Contributor

#5488 with a fix was merged, will be available in the next release.

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

2 participants