<div dir="ltr">Yes, this is really broken input! I thought it was bad some do +1 or 001 1 or no prefix to dial America!<div><br></div><div>To modify Ryan&#39;s code to make it more flexible...</div><div><br></div><div>^(?:\+1|001|1)?\D*(<span class="Apple-style-span" style>\d{3})\D*(\d{3})\D*(\d{4})$</span></div>

<div><span class="Apple-style-span" style><br>$1, $2 and $3 should give you the full number, so bridge to 1$1$2$3.</span></div><div><span class="Apple-style-span" style><font class="Apple-style-span" color="#222222" face="arial, sans-serif">it will match anything that has xxx-xxx-xxxx with <i>whatever</i> separating non-digits is in between.</font></span></div>

<div><span class="Apple-style-span" style><font class="Apple-style-span" color="#222222" face="arial, sans-serif">But it can only handle (by discarding) a prefix of +1, 1, or 001.</font></span></div><div><span class="Apple-style-span" style><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br>

</font></span></div><div><span class="Apple-style-span" style><font class="Apple-style-span" color="#222222" face="arial, sans-serif">I&#39;d suggest using xml_curl or a lua script and doing a regex replace of any non-digit characters, if you really need. But how in the world is this your input? What devices are sending this??</font></span></div>

<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font></div><div><div dir="ltr"><span style="font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-size:small">-Avi</span></span></div>


<br><br><div class="gmail_quote">On Mon, Dec 19, 2011 at 4:12 AM, Brian West <span dir="ltr">&lt;<a href="mailto:brian@freeswitch.org">brian@freeswitch.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word">Why do you have broken devices sending you numbers in that screwed up format in the request URI in the first place?  At this point you should be using XML_CURL then cleaning that up if this is what you&#39;re hitting.  Or you tell your clients to fix their badly broken behavior.<div>

<br></div><div>/b</div><div><br><div><div><div class="im"><div>On Dec 18, 2011, at 8:08 PM, Ryan V wrote:</div><br></div><blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div class="im">

On Mon, Dec 19, 2011 at 2:56 AM, Elliott Vogel &lt;<a href="mailto:elliott@zoogmedia.com" target="_blank">elliott@zoogmedia.com</a>&gt;wrote:<br><br><blockquote type="cite">I was wondering if anyone has a regex expression that works to return<br>

</blockquote><blockquote type="cite">just digest? I have some clients sending requests formatted to +1 (555)<br></blockquote><blockquote type="cite">555-5555, 555-555-5555, 555.555.5555 which aren’t be processed  by our dial<br>

</blockquote></div><blockquote type="cite">plan because we are expecting all numbers (5555555555) ****<br></blockquote><div class="im"><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote>How about this?<br>

<br>^\+1\s+\((\d{3})\)\s(\d{3})-(\d{4})$|^(\d{3})-(\d{3})-(\d{4})$|^(\d{3})\.(\d{3})\.(\d{4})$<br><br>$1, $2 and $3 should give you the full number.<br><br>Regards,<br><br>Ryan</div></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br>

<div>
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div style="word-wrap:break-word">

<div><div>-- </div><div>Brian West </div><div>FreeSWITCH Solutions, LLC</div><div>Phone: <a href="tel:%2B1%20%28918%29%20420-9266" value="+19184209266" target="_blank">+1 (918) 420-9266</a> </div><div>Fax:   <a href="tel:%2B1%20%28918%29%20420-9267" value="+19184209267" target="_blank">+1 (918) 420-9267</a></div>

<div><a href="mailto:brian@freeswitch.org" target="_blank">brian@freeswitch.org</a></div><div><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></div></div></div></span></span>
</div>
<br></font></span></div></div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div>