[Freeswitch-users] Need help on regex

mazilo Nabble at slickdeals.endjunk.com
Sun Oct 24 18:39:07 PDT 2010



Steven Ayre wrote:
> 
> <extension name="zero">
>   <condition field="destination_number"
> expression="^\d\d\d(0\d\d\d\d)\d\d$">
>     <!-- $1 holds the number -->
>   </condition>
> </extension>
> <extension name="nonzero">
>   <condition field="destination_number"
> expression="^(\d\d\d[123456789]\d\d\d\d\d\d)$">
>     <!-- $1 holds the number -->
>   </condition>
> </extension>
> 
> Steve on iPhone
Steven, thank you for your quick response. I reckon the \d\d\d is the same
as \d{3} such that above expressions can be rewritten as
expression="^\d{3}(0\d{4})\d{2}$" and expression="^(\d{3}[1-9]\d{6})$",
respectively. If so, is it possible to combine the two regex expressions
into a single expression using pipe within one dialplan? I tried
expression="^\d{3}(0\d{4})\d{2}$|^(\d{3}[1-9]\d{6})$" and it only works for
the 1st regex while the 2nd regex gives a null.

-----
don't and stop are the ONLY two 4-letter words considered offensive to men,
but not when used together.
-- 
View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Need-help-on-regex-tp5668666p5669081.html
Sent from the freeswitch-users mailing list archive at Nabble.com.



More information about the FreeSWITCH-users mailing list