[asterisk-users] Check if variable contains strings

Danny Nicholas danny at debsinc.com
Thu Jun 17 09:22:44 CDT 2010


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: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tzafrir Cohen
Sent: Thursday, June 17, 2010 9:05 AM
To: asterisk-users at lists.digium.com
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:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/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




More information about the asterisk-users mailing list