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

Re: MBEGIN, MEND in #m when pattern has "|"



On 4 June 2016 at 07:58, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> So if you change your expression to be one of
>
>     harray=( "${(f)${text//(#mi)(${~colsearch_pattern})/|$(( MBEGIN - 1 )) $((
> MEND )) fg=red,bold|$nl}%$nl*}" )
>
> [added parens around the alternates] or
>
>     harray=( "${(f)${text//(#i)${~colsearch_pattern}(#m)/|$(( MBEGIN - 1 )) $((
> MEND )) fg=red,bold|$nl}%$nl*}" )
>
> [moved (#m) to the end] then $MBEGIN et al. work as you desire.  I suspect
> you actually want the first with the parens because otherwise the (#i) also
> ends at the "|".

This helps, thanks! In my other project I was using (), probably
because I suspected that alternative requires it.

Best regards,
Sebastian Gniazdowski



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