Is it possible that the Lua libpcre implementation does not support '\ d'?

I found that \d not recognized as [0-9] . See My console output below:

 > require "rex_pcre" > return rex_pcre.new("[0-9]+"):exec("1234") 1 4 table: 0x2141ce0 > return rex_pcre.new("\d+"):exec("1234") nil 

Am I missing something or what?

UPDATE

As Kevin Ballard correctly answered, the haircut works! eg.

 > return rex_pcre.new("\\d+"):exec("1234") 1 4 table: 0x21427f0 > return rex_pcre.new([[\d+]]):exec("1234") 1 4 table: 0x2142ee0 

Thanks Kevin

+7
source share
1 answer

I represent this because \d interpreted as the escape of a Lua string. Use "\\d+" or [[\d+]] instead. The syntax is explained here .

+9
source

All Articles