[asterisk-bugs] [JIRA] (ASTERISK-20715) REGEX function ignores shorthand character starting with backslash

Matt Jordan (JIRA) noreply at issues.asterisk.org
Wed Nov 21 15:19:45 CST 2012


    [ https://issues.asterisk.org/jira/browse/ASTERISK-20715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=200001#comment-200001 ] 

Matt Jordan commented on ASTERISK-20715:
----------------------------------------

REGCOMP is built on the GNU extended regular expressions library (see {{regex.h}}).  That library does not support the shorthand characters (see [this comparison of regular expression libraries|http://www.regular-expressions.info/refflavors.html]).

As such, this is not a bug, but a limitation of the library that provides the regular expression functionality.

                
> REGEX function ignores shorthand character starting with backslash
> ------------------------------------------------------------------
>
>                 Key: ASTERISK-20715
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20715
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: 1.8.18.0
>         Environment: Centos Linux 5.8
>            Reporter: Cam
>
> The following code fragment SHOULD evaluate to 1 (in variable isittf) but it does not:
> {noformat}
> exten => s,n,Set(testnum=18005551212)
> exten => s,n,Set(tftest=^1?8(00|22|33|44|55|66|77|88)[2-9]\d{6}$)
> exten => s,n,Set(isittf=${REGEX("${tftest}" ${testnum})})
> exten => s,n,NoOp(Value of isittf is ${isittf})
> {noformat} 
> However if the second line above is changed to:
> {noformat} 
> exten => s,n,Set(tftest=^1?8(00|22|33|44|55|66|77|88)[2-9][0-9]{6}$)
> {noformat}
> Then it works. It appears that {noformat}\d{noformat} or probably any shorthand character starting with a backslash in the REGEX string is ignored or incorrectly parsed, even if first placed in a variable as I have done here.  I did try using a double backslash {noformat}\\d{noformat} but that did not work either.
> If there is a fix for this I would appreciate it if it could be backported to the 1.8 branch.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list