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

Javascript - avoid replaceAll #382

Open
MichalMarsalek opened this issue Apr 1, 2024 · 0 comments
Open

Javascript - avoid replaceAll #382

MichalMarsalek opened this issue Apr 1, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@MichalMarsalek
Copy link
Collaborator

Playground link

This is a kind of specific case, but the generated javascript prints $ while the original semantics was to print $$. This is caused by replaceAll interpreting the $ in the replacement string as capture groups, even when the search is not a regex. So it can actually only be used when the replacement is a text literal that doesn't contain a dollar. Otherwise the split + join trick should be used.
Alternatively, we could add a flag to the Text type (could also be useful for shorter replacement code in Lua) but that seems like an overkill.

@MichalMarsalek MichalMarsalek added bug Something isn't working good first issue Good for newcomers labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant