lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


thanks. i did not realize it was a pattern, i treated it as a raw string (old habits).

On Thu, 30 Jun 2016 18:29:07 +0300, Egor Skriptunoff wrote:

On Thu, Jun 30, 2016 at 6:14 PM, <saboteur@gmail.hu> wrote:

 i have a binanry file with bytes 5e c9 c3 somewhere in the middle

 i = data:find("\x5e\xc9\xc3")

 this returns nil. what is wrong?

"\x5E" is "^" which has special meaning in Lua patterns (beginning of the string)
Either escape "^" it with "%" or use plain search mode
i = data:find("\x5e\xc9\xc3", 1, true)