Closed aaronriekenberg closed 11 months ago
Fixed in version 1.10.0. Added an example for this https://github.com/aaronriekenberg/rust-parallel/wiki/Examples#processing-csv-inputs-using-regular-expression
Thanks @jyrimatti !
Thanks, that was quick :)
Another related thing I noticed is that dollar signs aren't escaped, which results in somewhat surprising behavior. It seems (perhaps) that a $ can be part of the command only if not followed by a letter, or if followed by parentheses:
> echo 'input' | rust-parallel -r '.*' -s 'foo={0}; echo $foo 1$ "$foo" "$(echo bar)"'
1$ bar
The correct behavior can be achieved by escaping the dollar sign:
> echo 'input' | rust-parallel -r '.*' -s 'foo={0}; echo $$foo 1$$ "$$foo" "$$(echo bar)"'
input 1$ input bar
I don't know Rust and I don't know how you might want to solve this, since having to deal with both shell-escaping and regex-escaping is becoming a bit complex. Viable option might be at least:
Thanks @jyrimatti for testing and reporting this.
Will give some thought on how to solve this. Reopening this issue for now.
@jyrimatti Made updates so that $
characters are escaped by the program before the expand function is called.
This fixes your scenario above. Made a release 1.10.1 - could you please test?
Have some possible thoughts on a design that does not use the regex expand function at all that might be simpler. Will experiment with this.
Also need to update the manual and examples with something similar to above as more things are becoming possible now :)
Thanks!
Decided to stay with expand function approach in parser::regex::RegexProcessor
Did a bit of code cleanup to RegexProcessor
Updated the manual:
Above changes are released in version 1.10.2
@jyrimatti I think issues you have reported are fixed and documentation is updated. Please comment or reopen if you find more issues. Thank you! 😄
Thanks, seems to work for my use cases 👍
Reported by @jyrimatti :
thanks for the feature! ...but with the command having any other use of curly braces breaks completely, for example:
I guess a good-enough fix would be to only consider references of format {[a-zA-Z0-9_]+} (or something similar) and nothing else?