-
Notifications
You must be signed in to change notification settings - Fork 217
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
DSL: need to be able to clear regex capture groups #1401
Comments
From #1399 by @archetyped: Is there a way to clear regex capture groups after a match is performed so that strings like Proof of concept: echo a=testing | mlr put -q '
val = "Test something here";
search = "(something)"i;
pre_match = "\1";
match = val =~ search;
post_match = "\1";
print "Variable (Pre-Match): " . pre_match;
print "Variable (Post-Match): " . post_match;
' Output: Variable (Pre-Match): \1
Variable (Post-Match): something Ideally there would be a way to set After a lot of debugging, I found this behavior to be the reason why some text replacements were not working as expected. Interestingly even a negative (
The capture groups appear to even persist into function calls when a match is performed in an outer (calling) function, which makes it even harder to track down when it results in unexpected behavior. |
@archeyped what do you think of #1448? |
@archetyped the reset logic is documented here: https://miller.readthedocs.io/en/man #in/reference-main-regular-expressions/#resetting-captures Please let me know if more is needed and we can re-open -- thanks! (Also, the |
@johnkerl Look forward to testing the updates when released. Thanks! |
Repro in #1399
The text was updated successfully, but these errors were encountered: