lua-users home
lua-l archive

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


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)