[Freeswitch-users] Need help on regex

mazilo Nabble at slickdeals.endjunk.com
Sun Oct 24 14:09:56 PDT 2010


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.



More information about the FreeSWITCH-users mailing list