[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PATCH] lstrlib and match() \0 in pattern strings
- From: Rene Rebe <rene@...>
- Date: Fri, 12 Mar 2010 23:53:13 +0100
On 12.03.2010, at 23:43, Patrick Donnelly wrote:
> On Fri, Mar 12, 2010 at 5:39 PM, Rene Rebe <rene@exactcode.de> wrote:
>> Hi all,
>>
>> I was just drafting some code filtering arbitrary binary data input, relying on Lua strings to handle embedded zeros. While I had no problems with that in the past, I just spotted the pattern of the matching does treat the first \0 as the end of the pattern. I hope I did not over-read a subtile area of the Lua manual that points out embedded zeros are not allowed in the string library pattern matching so that those examples should work as I would expect:
>
> See the character class %z in the Lua manual which matches the nul character.
Aha.
Still, the modifications to just support embedded zeros in the pattern aren't too many. Maybe it's worth that this would just work the intuitive way without the special exception for zeros in the pattern?
--
René Rebe, ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin
DE Legal: Amtsgericht Charlottenburg HRB 105123B, Tax-ID#: DE251602478
Managing Directors: Susanne Klaus, René Rebe
http://exactcode.com | http://t2-project.org | http://rene.rebe.de