I've gotta ask. What is the reason / business process you are doing that requires a complex regex/match like this?<br><br><div class="gmail_quote">On Mon, Oct 25, 2010 at 9:18 AM, mazilo <span dir="ltr"><<a href="mailto:Nabble@slickdeals.endjunk.com">Nabble@slickdeals.endjunk.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
Steve: Thank you and that does the trick. I try to modify the above regex</div>
filters so that it will become more user friendly using this<br>
expression="^(?|\d{3}(0\d{4})\d+|^(\d{3}[1-9]\d{6}))$". This way, the 1st<br>
regex filter (in bold) will process when the 4th digit is zero and only will<br>
capture starting from the 4th to 8th digits (a total of 5 digits) and will<br>
ignore the rest digits. In other words, if a user dials 12301234 or<br>
1230123456 or 123012345 or 1230123456789, the regex filter will only return<br>
01234. This works to a point, except if the entered number has an exact area<br>
code + 0 + 4 digits. For instance,<br>
<br>
10-digits input number output number Comments<br>
--------------------- ------------- ----------<br>
4120123456 01234 Does work<br>
41201234 Doesn't work<br>
412012346 01234 Does work<br>
0121234567 0121234567 Does work<br>
1310156434 01564 Does work<br>
131015643 01564 Does work<br>
13101564 Doesn't work<br>
8231234567 8231234567 Does work<br>
823123456 823123456 Does work<br>
0126543210 0126543210 Does work<br>
<br>
I can easily fix the above problem by introducing an additional regex filter<br>
into the above expression, i.e.<br>
expression="^(?|\d{3}(0\d{4})|\d{3}(0\d{4})\d+|^(\d{3}[1-9]\d{6}))$".<br>
However, if there is a better way to achieve this with less regex filter, it<br>
sure will be a plus.<br>
<br>
Mose: Thank you too even though the ":" doesn't seem to work. However, this<br>
bring an interesting thing for me to read the wiki<br>
<a href="http://wiki.freeswitch.org/wiki/Regular_Expression" target="_blank">http://wiki.freeswitch.org/wiki/Regular_Expression</a> ReGex so that I will<br>
understand further.<br>
<div class="im"><br>
-----<br>
don't and stop are the ONLY two 4-letter words considered offensive to men,<br>
but not when used together.<br></div></blockquote></div><br clear="all"><br>-- <br>-Rupa<br>