[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [PATCH] lstrlib and match() \0 in pattern strings
- From: Vaughan McAlley <ockegheim@...>
- Date: Sat, 13 Mar 2010 11:51:25 +1100
> 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.
Ah, so thatâs why "%z" exists...
I think the following would "pre-process" an arbitrary binary string,
making it ready to be searched for in another arbitrary binary string:
-- searching for s in another string...
s = string.gsub(s, "[%z%p]", function(c)
if c == "\0" then
return "%" .. c