[Asterisk-Users] Expression in Extension

Waldo Rubinstein waldo at trianet.net
Thu May 19 12:16:58 MST 2005


Matthew,

The ^ can also be used to negate when used within brackets as Hugh is  
trying to do. Hugh, from what I've read, the regex parser within the  
dial plan is very simple and does not understand that. What you can  
do is something like:

exten => _58X,1,GotoIf($[ "${EXTEN:3:1}" = "3" | "${EXTEN:3:1}" = "8"  
| "${EXTEN:3:1}" = "9"]?2:3)
exten => _58X,2,Hangup or Do whatever
exten => _58X,3,Dial(${${EXTEN}},${RINGLONG},tr)

Also, assuming asterisk understood the ^ symbol, your two expressions  
are equivalent. However, my understanding is that only the second  
expression will work.

Waldo

On May 19, 2005, at 2:37 PM, Matthew Boehm wrote:

> Hugh L. Johnson wrote:
>
>> Does ^ work as a NOT in an expression for extensions?
>> Are the following equivalent?
>>
>> exten => _58[^389],1,dial(${${EXTEN}},${RINGLONG},tr)
>>
>> exten => _58[0124567],1,dial(${${EXTEN}},${RINGLONG},tr)
>>
>
> Not sure which RegEx book you read but ^ (caret) stands for "line  
> beginning"
> not "don't match".
>
> -Matthew
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>




More information about the asterisk-users mailing list