Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: coloring substitution seems to eat next line.



On Mon, Nov 14, 2022 at 10:58 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> >> now I just need to understand the '#%' anchors
>
> I think I might:  Because it's a negation, you have to force the match
> to include the entire element from beginning to end.  You're sorta
> forcing a greedy match.

Yes, it forces a match of the entire string.  No, that's not the same
as "greedy".

Given a pattern like "#%(*)foo(*)" and a string like
"xxxfooyyyfoozzz", a "greedy" match would have the first (*) match
"xxxfooyyy".  A non-greedy match would have the second (*) match
"yyyfoozzz" because the non-greedy first (*) matched only "xxx" before
"foo".

This isn't particularly important in the context here, but if you were
using (#b) to activate backreferences it could be crucial.




Messages sorted by: Reverse Date, Date, Thread, Author