zsh-workers
 help / color / mirror / code / Atom feed
From: Marco Trevisan <marco@trevi.me>
To: zsh-workers@zsh.org
Subject: Handling of escaped plus sign ("+") in regular expressions
Date: Wed, 20 May 2020 21:18:33 +0200	[thread overview]
Message-ID: <CAALaScm2RSFT9=FnWWEVXkkxV_KuSO9-z9Jv1NMeuex_9eF9TQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

Hi,

I've been using zsh to run some local scripts I was normally running with
bash and while most of them work as expected, there's a case that weirdly
failed to me (using zsh 5.8):

[[ +123 =~ ^+[0-9]+$ ]]
zsh: failed to compile regex: Invalid preceding regular expression

[[ +123 =~ ^\+[0-9]+$ ]]
zsh: failed to compile regex: Invalid preceding regular expression

The same behavior seems to apply both using RE_MATCH_PCRE and not.
As said, both matches correctly using bash.

Using something like

[[ +123 =~ ^[+][0-9]+$ ]]

Works as expected instead.

             reply	other threads:[~2020-05-20 19:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20 19:18 Marco Trevisan [this message]
2020-05-20 19:51 ` Eric Cook
2020-05-20 20:00   ` Eric Cook

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='CAALaScm2RSFT9=FnWWEVXkkxV_KuSO9-z9Jv1NMeuex_9eF9TQ@mail.gmail.com' \
    --to=marco@trevi.me \
    --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).