Digit character class usage in REGEX

It looks like the \d special pattern characters are not recognized by the REGEX Dialplan Function

 same => n, Verbose(1,${REGEX("\\w" 7000)})
 same => n, Verbose(1,${REGEX("\\d" 7000)})
 same => n, Verbose(1,${REGEX("[[:digit:]]" 7000)})
    -- Executing [7000@test:2] Verbose("Message/ast_msg_queue", "1,1") in new stack
 1
    -- Executing [7000@test:3] Verbose("Message/ast_msg_queue", "1,0") in new stack
 0
    -- Executing [7000@test:4] Verbose("Message/ast_msg_queue", "1,1") in new stack
 1

Am I missing anything?

Try to use

same => n, Verbose(1,${REGEX("[[:alnum:]]" 7000)})
same => n, Verbose(1,${REGEX("[[:digit:]]" 7000)})
same => n, Verbose(1,${REGEX("[[:digit:]]" 7000)})

That’s what you can see in my example, [[:digit:]] works, but \d does not for some reason, I’m trying to understand is it me or is it a bug/feature.

Sorry, my mistake! I’ve had the same problem before, and I just got excited and wrote it as soon as I saw the regex. :sweat_smile:

REGEX function uses POSIX regular expressions, which have slightly different syntax and rules compared to other regular expression engines. The \d and \w shortcuts are not recognized by POSIX, which is why your second REGEX check fails.

https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions

It looks like that statement is wrong too, look at the first line in my example, it uses \w and works fine, that’s why I asked specifically about \d