[Freeswitch-users] Need help on regex
Rupa Schomaker
rupa at rupa.com
Mon Oct 25 07:29:26 PDT 2010
I've gotta ask. What is the reason / business process you are doing that
requires a complex regex/match like this?
On Mon, Oct 25, 2010 at 9:18 AM, mazilo <Nabble at slickdeals.endjunk.com>wrote:
>
> Steve: Thank you and that does the trick. I try to modify the above regex
> filters so that it will become more user friendly using this
> expression="^(?|\d{3}(0\d{4})\d+|^(\d{3}[1-9]\d{6}))$". This way, the 1st
> regex filter (in bold) will process when the 4th digit is zero and only
> will
> capture starting from the 4th to 8th digits (a total of 5 digits) and will
> ignore the rest digits. In other words, if a user dials 12301234 or
> 1230123456 or 123012345 or 1230123456789, the regex filter will only return
> 01234. This works to a point, except if the entered number has an exact
> area
> code + 0 + 4 digits. For instance,
>
> 10-digits input number output number Comments
> --------------------- ------------- ----------
> 4120123456 01234 Does work
> 41201234 Doesn't work
> 412012346 01234 Does work
> 0121234567 0121234567 Does work
> 1310156434 01564 Does work
> 131015643 01564 Does work
> 13101564 Doesn't work
> 8231234567 8231234567 Does work
> 823123456 823123456 Does work
> 0126543210 0126543210 Does work
>
> I can easily fix the above problem by introducing an additional regex
> filter
> into the above expression, i.e.
> expression="^(?|\d{3}(0\d{4})|\d{3}(0\d{4})\d+|^(\d{3}[1-9]\d{6}))$".
> However, if there is a better way to achieve this with less regex filter,
> it
> sure will be a plus.
>
> Mose: Thank you too even though the ":" doesn't seem to work. However, this
> bring an interesting thing for me to read the wiki
> http://wiki.freeswitch.org/wiki/Regular_Expression ReGex so that I will
> understand further.
>
> -----
> don't and stop are the ONLY two 4-letter words considered offensive to men,
> but not when used together.
>
--
-Rupa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101025/5029189c/attachment.html
More information about the FreeSWITCH-users
mailing list