Search code examples
asterisk

How to search the particular character in one word in asterisk server?


How to search the particular character in given sentence in asterisk server?

Ex:-

word="test"

here

word - variable name

test - value of the variable

I want to search the 'e' character is present or not in given "test" value in asterisk server.

Is the any inbuilt command in asterisk server?


Solution

  • The REGEX function returns 1 if data matches regular expression or 0 otherwise.

    So,

    exten => s,n,Set(foo=${REGEX("[e]" ${word})})

    The foo returns the "1" because the letter "e" matched