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})})

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Tzafrir Cohen
Sent: Thursday, June 17, 2010 9:05 AM
To: [email protected]
Subject: Re: [asterisk-users] Check if variable contains strings

On Thu, Jun 17, 2010 at 03:37:15PM +0200, Jonas Kellens wrote:
> Hello.
>
> Can I check if a variable contains some string ??
>
> suppose Set(var=foobar)
>
> can I check if ${var} contains "foo" ??

core show function REGEX. Should work well as long as the string to
match has no special characters of its own.

-- 
               Tzafrir Cohen
icq#16849755              jabber:[email protected]
+972-50-7952406           mailto:[email protected]
http://www.xorcom.com  iax:[email protected]/tzafrir

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to