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

Re: BUG: ${var##(|A)} fails to find longest prefix



There's no backtracking for X|Y

Really? But then why doesn't  s=AA; echo ${s#(A|)A} print the empty string?

Philippe


On Mon, May 12, 2025 at 11:25 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
Section 14.8

X|Y
     Matches either X or Y.  This operator has lower precedence than any
     other.  The '|' character must be within parentheses, to avoid
     interpretation as a pipeline.  The alternatives are tried in order
     from left to right.

There's no backtracking for X|Y


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