zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Feature request (#b)...(...)<not empty>
Date: Sat, 25 Feb 2017 13:05:25 -0800	[thread overview]
Message-ID: <170225130525.ZM22939@torch.brasslantern.com> (raw)
In-Reply-To: <1488045262.2349123.892698344.1068648E@webmail.messagingengine.com>

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.

} I'm not sure if regexes work this way.. Maybe I'm loosing it for a
} moment, but:
} 
} [[ abc =~ ab(|c) ]] && echo "I've tried multiple options"
} zsh: failed to compile regex: empty (sub)expression

Yes, that's also correct.  Zsh patterns are not regexes and the default
regex library doesn't allow that syntax.  I believe you can use that
syntax if you load the zsh/pcre module and setopt REMATCH_PCRE.


  reply	other threads:[~2017-02-25 21:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25  8:37 Sebastian Gniazdowski
2017-02-25 15:13 ` Daniel Shahaf
2017-02-25 15:36   ` Sebastian Gniazdowski
2017-02-25 16:47     ` Bart Schaefer
2017-02-25 17:24       ` Sebastian Gniazdowski
2017-02-25 17:54         ` Daniel Shahaf
2017-02-25 20:38         ` Bart Schaefer
2017-02-25 17:54       ` Sebastian Gniazdowski
2017-02-25 21:05         ` Bart Schaefer [this message]
2017-02-25 22:52           ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170225130525.ZM22939@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).