zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-users@zsh.org
Subject: Re: regex matching regression in 5.0.0 vs. 4.3.17
Date: Sat, 15 Sep 2012 19:52:19 -0400	[thread overview]
Message-ID: <20120915235219.GA97656@redoubt.spodhuis.org> (raw)
In-Reply-To: <20120915204246.0bb41f96@pws-pc.ntlworld.com>

On 2012-09-15 at 20:42 +0100, Peter Stephenson wrote:
> So unless anyone can think of a smart solution, I think the only answer
> is to remove NULL characters from the body of the regular expression and
> document that this happens.

The situation sucks, clearly.

So: is it better to change the NUL to something else, to strip it out
(shortening the pattern) or to just document that NULs are bad?

For the POSIX system library regex module, a NUL will always be bad.

For PCRE, pcre_exec() takes a length parameter for the haystack string,
so one option might be to change the NUL in the _pattern_ to be \x00
instead?

It seems that for PCRE, supplying a length-receiving parameter to
unmetafy() and comparing that to strlen() should be right, and then
switching the result if so.

If I do this, then zsh/pcre should be able to handle NULs fine in both
needle/pattern and haystack.

For regex .. generally, I'm not in favour of hidden mutations of strings
which might change whether they match or not.  I can just document it as
a limitation of non-PCRE?

-Phil


      parent reply	other threads:[~2012-09-16  0:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-15 15:37 Moritz Bunkus
2012-09-15 19:42 ` Peter Stephenson
2012-09-15 21:12   ` Moritz Bunkus
2012-09-15 23:52   ` Phil Pennock [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=20120915235219.GA97656@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@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).