From: Stephane Chazelas <stephane@chazelas.org>
To: zzapper <zsh@rayninfo.co.uk>, zsh-users@zsh.org
Subject: Re: Can I test if a parameter expansion has worked
Date: Tue, 20 Sep 2022 14:31:12 +0100 [thread overview]
Message-ID: <20220920133112.65zrda7manh4w37s@chazelas.org> (raw)
In-Reply-To: <20220920132551.vetlxrk7swkb4c4w@chazelas.org>
2022-09-20 14:25:51 +0100, Stephane Chazelas:
[...]
> ITYM
>
> if [[ $f =~ '\.(jpe?g|gif|png)$' ]]
[...]
Which, btw, if the rematchpcre option is on must be changed to:
if [[ $f =~ '\.(jpe?g|gif|png)\z' ]]
As otherwise, that would match on f=$'foo.gif\n' for instance.
With rematchpcre, see also:
$ f=$'St\xe9phane.jpg'
$ [[ $f =~ '\.(jpe?g|gif|png)\z' ]]
zsh: pcre_exec() error [-10]
Not fixed with:
$ LC_ALL=C [ "$f" '=~' '\.(jpe?g|gif|png)\z' ]
zsh: pcre_exec() error [-10]
(bug?)
--
Stephane
prev parent reply other threads:[~2022-09-20 13:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 10:03 zzapper
2022-09-14 18:36 ` Bart Schaefer
2022-09-15 0:08 ` Alex Satrapa
2022-09-15 7:34 ` zzapper
2022-09-15 8:24 ` Peter Stephenson
2022-09-15 8:38 ` zzapper
2022-09-15 16:48 ` Bart Schaefer
2022-09-20 7:14 ` david rayner
2022-09-16 0:41 ` Alex Satrapa
2022-09-20 12:49 ` Stephane Chazelas
2022-09-20 13:25 ` Stephane Chazelas
2022-09-20 13:31 ` Stephane Chazelas [this message]
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=20220920133112.65zrda7manh4w37s@chazelas.org \
--to=stephane@chazelas.org \
--cc=zsh-users@zsh.org \
--cc=zsh@rayninfo.co.uk \
/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).