title: How to modify this regex to exclude punctuation in a URL?
body: <p>I've modified a regex that I found <a href="http://daringfireball.net/2010/07/improved_regex_for_matching_urls" rel="nofollow">here</a> so that it would accept various UK and second-level TLDs.</p>
  
  <pre><code>/\b((?:^https?:\/\/|^[a-z0-9.\-]+[.][a-z]{2,4})(?:[^\s()&lt;&gt;]+|\(([^\s()&lt;&gt;]+|(\([^\s()&lt;&gt;]+\)))*\))+(?:\(([^\s()&lt;&gt;]+|(\([^\s()&lt;&gt;]+\)))*\)|[^\s`!@()\[\]{};:'".,&lt;&gt;?]))/i
  </code></pre>
  
  <p>However as you can see in my test data <a href="http://rubular.com/r/3KgVUrL1iz" rel="nofollow">here</a>, the regex matches URLs such as <code>www.zapple.@com</code> and <code>https://m!crosoft.com</code> which are not valid.</p>
  
  <p>For some reason <code>@</code> symbols are excluded before the <code>.com</code> but after the <code>.</code> they are not. </p>
  
  <p>Exclamation marks are not excluded at all which is confusing since, as far as I can see, only letters, numbers and dashes are allowed before the period.</p>