[asterisk-users] Check if variable contains strings

Danny Nicholas danny at debsinc.com
Thu Jun 17 10:11:51 CDT 2010


Being a "PERL Weenie" I don't delve into regular expressions any more than I
have to.  That caveat given, these "changes" produced the desired (and
correct?) testing results

exten => 1234,n,Set(test=${REGEX("foo" ${footest})})
exten => 1234,n,verbose(test returned ${test})
returns 1

exten => 1234,n,Set(test=${REGEX("fob" ${footest})})
exten => 1234,n,verbose(test returned ${test})
returns 0

 

 

  _____  

From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Jonas Kellens
Sent: Thursday, June 17, 2010 10:02 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Check if variable contains strings

 

This also gives result "1" but is not correct :

exten => 1234,n,Set(test2=${REGEX("[fot]" ${footest})})
exten => 1234,n,verbose(test2 returned ${test2})

[Jun 17 16:59:01]     -- Executing [1234 at from:7] Verbose("SIP/13-00000096",
"test2 returned 1") in new stack
[Jun 17 16:59:01] test2 returned 1


Jonas


On 06/17/2010 04:22 PM, Danny Nicholas wrote: 

This worked in 1.4.30
; regex test
exten => 1234,1,Answer
exten => 1234,n,Set(footest=foobar)
exten => 1234,n,verbose(test value ${footest})
exten => 1234,n,Set(test=${REGEX("[foo]" ${footest})})
exten => 1234,n,verbose(test returned ${test})
exten => 1234,n,Playback(vm-goodbye)
exten => 1234,n,hangup
 
This line did not
exten => 1234,n,Set(test=${REGEX("/foo/" ${footest})})
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100617/bc5c98c2/attachment.htm 


More information about the asterisk-users mailing list