zsh-workers
 help / color / mirror / code / Atom feed
* Handling of escaped plus sign ("+") in regular expressions
@ 2020-05-20 19:18 Marco Trevisan
  2020-05-20 19:51 ` Eric Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Marco Trevisan @ 2020-05-20 19:18 UTC (permalink / raw)
  To: zsh-workers

[-- 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-20 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 19:18 Handling of escaped plus sign ("+") in regular expressions Marco Trevisan
2020-05-20 19:51 ` Eric Cook
2020-05-20 20:00   ` Eric Cook

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).