[Freeswitch-users] Need help on regex

Steven Ayre steveayre at gmail.com
Sun Oct 24 15:51:37 PDT 2010


<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

On 24 Oct 2010, at 22:09, mazilo <Nabble at slickdeals.endjunk.com> wrote:

> 
> I am not much of a regex person but am looking for some help on crafting a
> simple regex filter that can do the following criterias:
> 
> 1. The dialed number is always a 10-digits number, i.e. an area code +
> 7-digits number (without any leading digit(s) of +1 and/or 1).
> 
> 2. If the 4-th digit of the dialed number (after the area code) is a
> non-zero number, do nothing. Otherwise, the regex filter will strip the
> leading 3 digits (area code) as well as the last 2 digits number and this
> will leave only 1-st 5-digits number (no area code). For instance, if the
> 10-digits dialed number is 0120123456, then the regex filter will return
> 01234. More examples followed:
> 
> 10-digits input number     output number
> ---------------------      -------------
>    4120123456                01234
>    0121234567                0121234567
>    1310156434                01564
>    8231234567                8231234567
>    0126543210                0126543210
> Anyone? Thanks.
> 
> -----
> 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-tp5668666p5668666.html
> Sent from the freeswitch-users mailing list archive at Nabble.com.
> 
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org



More information about the FreeSWITCH-users mailing list