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

Regex Backreference Variables Not Accessible in Replacement Function #639

Closed
metrixsam opened this issue Dec 28, 2024 · 2 comments
Closed
Labels
feature New feature

Comments

@metrixsam
Copy link

metrixsam commented Dec 28, 2024

Regular expressions allow caching the matching results for parenthesized patterns (e.g. ([a-z]+) ) into indexed variables. These results can later be accessed in the same search pattern through backreferences (e.g. \1, \2, \3, etc).
Screenshot_2024-12-28-20-17-51-95

Various tools and code editors (e.g. Ace, VSCode) allow accessing these indexed variables by prefixing the index number with $ in the replacement pattern (e.g. $1, $2, $3, etc).
Screenshot_2024-12-28-09-25-40-92
Screenshot_2024-12-28-09-26-10-52

This doesn't happen with Sora.
Screenshot_2024-12-28-20-18-14-74

@RohitKushvaha01
Copy link

RohitKushvaha01 commented Jan 15, 2025

this functionality is not dependent on the sora editor. Instead, it must be implemented by the application itself

@metrixsam
Copy link
Author

this functionality is not dependent on the sora editor. Instead, it must be implemented by the application itself

I don't know for sure to be honest since I didn't read the source code for Sora editor. But I tested it on the bare demos of other editors like Ace and Monaco and it worked as seen in the screenshots. Another reason for my guess that it has to do with Sora is because of an issue like this in Ace itself that affects editors based on it, like Acode in this issue as mentioned (and fixed) in this comment. This issue doesn't occur in the search/replace function in Sora and Monaco editors themselves, thus preventing it from occuring in any code editor applications derived from them like VSCode (based on Monaco), Xed-Editor (based on Sora) and Visual Code Space (based on Sora and Monaco).

Ace Backreference Test

Screenshot_2025-01-15-15-20-39-81
Screenshot_2025-01-15-15-21-25-54

Monaco Backreference Test

IMG_20250115_151827
IMG_20250115_151849

@Rosemoe Rosemoe added the feature New feature label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

3 participants