lua-users home
lua-l archive

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


On 2 December 2013 05:23, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> I can't understand the following.
>
> $ lua
> Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
>> utfpat = "[\xC0-\xEF][\x80-\xBF]*"
>> s="the quick brown fox jumps over the lazy dog"
>> =s:find(utfpat)
> nil
>>
> $ lua515
> Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
>> utfpat = "[\xC0-\xEF][\x80-\xBF]*"
>> s="the quick brown fox jumps over the lazy dog"
>> =s:find(utfpat)
> 1       3
>>
>

Lua 5.1.x doesn't recognize hex escapes in strings. They we're added in 5.2.

Try:

lua515 -e 'print("[\xC0-\xEF][\x80-\xBF]*")'

v.s.

lua -e 'print("[\xC0-\xEF][\x80-\xBF]*")'