Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: regex matching regression in 5.0.0 vs. 4.3.17
- X-seq: zsh-users 17270
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: regex matching regression in 5.0.0 vs. 4.3.17
- Date: Sat, 15 Sep 2012 19:52:19 -0400
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201107; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=pujaxWgsTMk9Z66kpUx0RRvt3kqaK9uD1kNsWXWomP0=; b=nzoCqzYGa+PjCXKVBTKzyPKu4oV8eFxlRoLnNUh9jzPZNA7c0cjyWVbnxUlgNg5Tt7z43/U6m8zNdvt5wzzZHrRiCeREjWRkZnWzWnq665OFl8rUe9zEIDto8x4WyC0TN2Gr5DkVrOKlUzNJrTHQGPufWrELgVN2BoM38rROLBo=;
- In-reply-to: <20120915204246.0bb41f96@pws-pc.ntlworld.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CANPayMThANJBYsnViEO6pC8RtQNXKLgCwyWuMa24JnZppBjLgA@mail.gmail.com> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author