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

Cam (JIRA) noreply at issues.asterisk.org
Wed Nov 21 12:25:45 CST 2012


     [ https://issues.asterisk.org/jira/browse/ASTERISK-20715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cam updated ASTERISK-20715:
---------------------------

    Description: 
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, 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.

  was:
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, 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.

    
> 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, 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