[Asterisk-Users] Re: regexp in gotoif

Christian B bencokakao at gmail.com
Wed Apr 19 12:27:19 MST 2006


On Fri, 7 Apr 2006 16:22:33 +0200
Christian B <bencokakao at gmail.com> wrote:

> Hello!
> 
> this is a short one: in a gotoif-statement i would like to match a
> variable to a number, where the number could have digits from 2-6.
> asterisk only seems to be capable to match such a digit-range when used
> in the extension, but not in a regexp, at least the following query
> doesn't work:
> 
> 
> exten => _X.,1,GotoIf($[${EXTEN} : 234[2-6]]?jump:)
> 
> 
> obviously asterisk has a problem with this since it parses the brackets
> differently, i've also tried to do it like:
> 
> 
> exten => _X.,1,GotoIf($[${EXTEN} : 234\[2-6\]]?jump:)
> 
> 
> but of course this didn't work(was a desperate try anyways).
> 
> is there a way to match a range like it is possible with unix regexps
> (a-zA-Z1-9)?
> 
> thanks for your replies!
> 
> christian


works with function regexp -> http://www.voip-info.org/wiki/index.php?page=Asterisk%20func%20regex

e.g.:

GotoIf($[${REGEX("2-6" ${EXTEN:0:1})}]?jump:)

should retrun 1 if $EXTEN begins with 2,3,4,5 or 6...

regards
christian



More information about the asterisk-users mailing list