I find that \d
is 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 have correctly answered, string escaping works! e.g.
> return rex_pcre.new("\\d+"):exec("1234")
1 4 table: 0x21427f0
> return rex_pcre.new([[\d+]]):exec("1234")
1 4 table: 0x2142ee0
Thanks Kevin
I imagine it's because \d
is being interpreted as a string escape by Lua. Try using "\\d+"
or [[\d+]]
instead. The syntax is explained here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With