lua-users home
lua-l archive

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


On 28 October 2014 02:54, Jain, Punit <Punit.Jain@emc.com> wrote:

Hi All,

 

How can I check whether a string is a hexadecimal number or not? E.g. “0x123” is a hex string, but “123” and “xyz” are not.

 

Thanks,

Punit


Use the %x character class:

str:match("^0x%x+$")