[Asterisk-Users] Bug in my head or bug in the code?

John Todd jtodd at loligo.com
Fri Sep 5 20:47:16 MST 2003


I am having Yet Another Regular Expression problem, but this one 
might not be my fault, or at least it might not be obviously my 
fault.  :-)


exten => 2212,1,SetVar(FOO=123456**)
exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = *])

This script continues with a value of 0 in BAR.

Similarly, none of the following changes made a difference in that 
result, which is expected since the * is not listed in 
README.variables as a character that must be escaped:

exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = "*"])
exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = "\*"])
exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = \*])

I have also tried setting the variable ${BAZ}=*  and then using that 
in my comparison, with the same unexpected results.

Oddly enough, this almost-identical example below has different, but 
"normal", results: BAR=1

exten => 2212,1,SetVar(FOO=123456##)
exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = #])


What gives?  Am I colliding with a problem that is the result of the 
"*" character being used in expr evaluations and somehow not being 
handled correctly, or am I simply not implementing the syntax 
correctly?

JT



More information about the asterisk-users mailing list