2009/2/4 Klaus Darilion <[email protected]>

> Hi!
>
> I am going nuts using REGEXP. I just want to verify if a variable
> contains a valid +E164 phone number.
>
> These, the the pattern is ^\+[0-9]+
>
> First I tried:
>
>   Set(pattern=^\+[0-9]+);
>   if (${REGEX("${pattern}" ${${var}})})
>
> but that does not work, the backslash is removed, as seen in the log file:
>
>   func_strings.c: FUNCTION REGEX (^+[0-9]+)(+4312345
> <http://www.adaanumber.com/>)
>
> So, meanwhile I tried to escape the backslash. I tried:
>   Set(pattern=^\\+[0-9]+);
>   Set(pattern=^\\\+[0-9]+);
>   Set(pattern=^\\\\+[0-9]+);
>
> But always the same result:
>
>   func_strings.c: FUNCTION REGEX (^+[0-9]+)(+4312345)
>
> How can I solve this problem?
>

Try something like... pattern=^[+]\{1\}[0-9]+

d
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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

Reply via email to