<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Michael and Ken,<br>
<br>
Thanks for setting me on the right track! What I end-up
configuring for now is:<br>
<br>
^(?:1)?([2-9]\d{2}[2-9]\d{6})(?:;npdi=(?:yes|no))?(?:;rn=([2-9]\d{2}[2-9]\d{6}))?(?:;npdi=(?:yes|no))?<br>
<br>
It puts destination number in $1. It also puts LRN in $2 provided
it's supplied. Either yes or no are allowed for npdi=. I'm not
capturing npdi= into any variable because as I realized all I
really need is LRN.<br>
<br>
For example, all of these:<br>
6045555555;npdi=yes;rn=7785550001<br>
6045555555;rn=7785550001;npdi=yes<br>
16045555555;npdi=yes;rn=7785550001<br>
6045555555;rn=7785550001<br>
<br>
Will pass and result in:<br>
$1=6045555555<br>
$2=7785550001<br>
<br>
And all of these:<br>
6045555555<br>
16045555555<br>
6045555555;npdi=yes<br>
6045555555;npdi=no<br>
<br>
Will also pass and give:<br>
$1=6045555555<br>
$2=empty<br>
<br>
I'll be glad if this regexp example helps someone.<br>
<br>
Cheers,<br>
-Victor<br>
<pre class="moz-signature" cols="72">
</pre>
On 13-01-07 08:59 PM, Michael Collins wrote:<br>
</div>
<blockquote
cite="mid:CAKzWOxUGnU=uvY19f7ZgXJc202oy7g9-NJdf+7iFFiup6O1sOA@mail.gmail.com"
type="cite">In this case the ? modifies the *, so there's .*
(greedy) and .*? (not greedy)<br>
<br>
You want your .* to match as little as possible instead of as much
as possible. If you use .* instead of .*? then your $2 would
contain both the ndpi info but also it would have
";rn=18005551212" b/c the .* would grab all that stuff. The .*?
would only grab up to the ";rn".<br>
<br>
Just adding that info for posterity's sake. :)<br>
<br>
-MC<br>
<br>
<div class="gmail_quote">On Mon, Jan 7, 2013 at 5:05 PM, Ken Rice
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:krice@freeswitch.org" target="_blank">krice@freeswitch.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<font face="Monaco, Courier New"><span
style="font-size:11pt">Ooops yeah I mean .*... The ? Is
pretty useless there... Since there should always be
something if they send ndpi=<br>
<br>
<br>
On 1/7/13 7:00 PM, "Michael Collins" <<a
moz-do-not-send="true"
href="http://msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>>
wrote:<br>
</span></font>
<blockquote>
<blockquote>
<blockquote><font face="Monaco, Courier New"><span
style="font-size:11pt"><br>
</span></font></blockquote>
</blockquote>
<font face="Monaco, Courier New"><span
style="font-size:11pt">Just a quick FYI... be careful
when you use .* because it will try to match
EVERYTHING. Also, Ken accidentally typed (*.) which
I'm sure wasn't what he was aiming for. ;)<br>
<br>
Maybe this would be more effective:<br>
^(?:+1|1)?([2-9]\d{2}[2-9]\d{6});ndpi=(.*?);rn=([2-9]\d{2}[2-9]\d{6})$<br>
<br>
-MC<br>
<br>
<hr size="3" width="95%" align="CENTER"></span></font><font><font
face="Consolas, Courier New, Courier"><span
style="font-size:10pt">_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a moz-do-not-send="true"
href="http://consulting@freeswitch.org"
target="_blank">consulting@freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://www.freeswitchsolutions.com"
target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication
Server<br>
<a moz-do-not-send="true"
href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a moz-do-not-send="true"
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a moz-do-not-send="true"
href="http://FreeSWITCH-users@lists.freeswitch.org"
target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a moz-do-not-send="true"
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><span
class="HOEnZb"><font color="#888888"><br>
</font></span></span></font></font></blockquote>
<span class="HOEnZb"><font color="#888888"><font><font
face="Consolas, Courier New, Courier"><span
style="font-size:10pt"><br>
</span></font></font><font face="Monaco, Courier
New"><span style="font-size:11pt">-- <br>
Ken<br>
<font color="#0000FF"><u><a moz-do-not-send="true"
href="http://www.FreeSWITCH.org"
target="_blank">http://www.FreeSWITCH.org</a><br>
<a moz-do-not-send="true"
href="http://www.ClueCon.com" target="_blank">http://www.ClueCon.com</a><br>
<a moz-do-not-send="true"
href="http://www.OSTAG.org" target="_blank">http://www.OSTAG.org</a><br>
</u></font><a moz-do-not-send="true"
href="http://irc.freenode.net" target="_blank">irc.freenode.net</a>
#freeswitch<br>
</span></font>
</font></span></div>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a moz-do-not-send="true"
href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a moz-do-not-send="true" href="http://www.cudatel.com"
target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a moz-do-not-send="true" href="http://www.freeswitch.org"
target="_blank">http://www.freeswitch.org</a><br>
<a moz-do-not-send="true" href="http://wiki.freeswitch.org"
target="_blank">http://wiki.freeswitch.org</a><br>
<a moz-do-not-send="true" href="http://www.cluecon.com"
target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a moz-do-not-send="true" href="http://www.freeswitch.org"
target="_blank">http://www.freeswitch.org</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Michael S Collins<br>
Twitter: @mercutioviz<br>
<a moz-do-not-send="true" href="http://www.FreeSWITCH.org"
target="_blank">http://www.FreeSWITCH.org</a><br>
<a moz-do-not-send="true" href="http://www.ClueCon.com"
target="_blank">http://www.ClueCon.com</a><br>
<a moz-do-not-send="true" href="http://www.OSTAG.org"
target="_blank">http://www.OSTAG.org</a><br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a class="moz-txt-link-freetext" href="http://www.cudatel.com">http://www.cudatel.com</a>
Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
</pre>
</blockquote>
<br>
</body>
</html>