Closed balupton closed 2 years ago
This is the expected behavior. Unfortunately, I have no plans to support the behavior in the future.
If you hope to match with multi-line mode, please use the -z
option like this.
$ echo $'a\nb\nc\na\nb\nc' | teip -z -g '\nb' -o
a[
b]
c
a[
b]
c
Let me explain the technical background.
teip
can give only the matched parts to another command.
In this case, each occurence is concatenated with a newline and given as standard input.
Therefore, if the single occurence contains newlines, it will cause unexpected behavior, so the flag is set to a fixed value.
When the -z
option is used, the NUL character is used as the concatination character, so it is controlled to avoid problems (see README for detailed behavior).
I'm assuming this uses the rust regex engine:
https://docs.rs/regex/latest/regex/#grouping-and-flags
Of which the following should work right?
Such that I can do:
to get back:
As such works with sd