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

Re: Feature request (#b)...(...)<not empty>



Bart Schaefer wrote on Sat, Feb 25, 2017 at 13:05:25 -0800:
> On Feb 25,  9:54am, Sebastian Gniazdowski wrote:
> }
> } ${a//(#b)ab(|c)/x} "<- last one shows | isn't greedy"
> } x x xc <- last one shows | isn't greedy
> 
> Yes, you're correct.  Putting the shorter (in this case empty) alternate
> first in the parens makes that particular subexpression non-greedy.  This
> was a deliberate choice -- though I can't find that it's been documented
> anywhere, on a brief search.

diff --git a/Doc/Zsh/roadmap.yo b/Doc/Zsh/roadmap.yo
index bd064e2..94ef74d 100644
--- a/Doc/Zsh/roadmap.yo
+++ b/Doc/Zsh/roadmap.yo
@@ -139,6 +139,9 @@ startitem()
 item(tt(**))(
 for matching over multiple directories
 )
+item(tt(|))(
+for matching either of two alternatives
+)
 item(tt(~), tt(^))(
 the ability to exclude patterns from matching when the tt(EXTENDED_GLOB)
 option is set
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 43ecd31..319409d 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -2100,6 +2100,7 @@ Matches either var(x) or var(y).
 This operator has lower precedence than any other.
 The `tt(|)' character
 must be within parentheses, to avoid interpretation as a pipeline.
+The alternatives are tried in order from left to right.
 )
 item(tt(^)var(x))(
 (Requires tt(EXTENDED_GLOB) to be set.)



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