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:
> hi,
>
>  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?
>
> thanks
>
>
>

Hi!

In Lua hex-escaping like "\x5e" doesn't work.

>From Lua manual:

> A character in a string can also be specified by its numerical value using the escape sequence \ddd, where ddd is a sequence of up to three decimal digits. (Note that if a numerical escape is to be followed by a digit, it must be expressed using exactly three digits.)

Replace "\x5e\xc9\xc3" with "^\201\195"

-- 


Best regards,
Boris Nagaev