[asterisk-users] Check if variable contains strings

Tilghman Lesher tlesher at digium.com
Thu Jun 17 10:27:58 CDT 2010


On Thursday 17 June 2010 10:01:40 Jonas Kellens wrote:
> 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

Actually, it is correct.  Your regex specifies a match for any string
that contains "f" or "o" or "t", because the square brackets create
a character class.  If you remove the square brackets, it will do what
you expect.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list