[Freeswitch-users] Need help on regex

Russell Mosemann Russell.Mosemann at cune.org
Sun Oct 24 18:59:54 PDT 2010


mazilo wrote:

> 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.

"^(?:\d{3}(0\d{4})\d{2}|(\d{3}[1-9]\d{6}))$"

Note that if the first value is captured, it will be in $1. The second captured value will be in $2.

This is described at http://wiki.freeswitch.org/wiki/Regular_Expression


mose




More information about the FreeSWITCH-users mailing list