title: Question about URL Validation with Regex
body: <p>I have the following regex that does a great job matching urls: </p>
  
  <pre><code>((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&amp;]*)`
  </code></pre>
  
  <p>However, it does not handle urls without a prefix, ie. <strong>stackoverflow.com</strong> or <strong>www.google.com</strong> do not match.  Anyone know how I can modify this regex to not care if there is a prefix or not?</p>
  
  <hr>
  
  <p>EDIT: Does my question too vague? Does it need more details?</p>
  
  <hr>
  
  <pre><code>(((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\)))?[\w\d:#@%/;$()~_?\+-=\\\.&amp;]*)
  </code></pre>
  
  <p>I added a ()? around the protocols like <strong>Vinko Vrsalovic</strong> suggested, but now the regex will match nearly any string, as long as it has valid URL characters.</p>
  
  <p>My implementation of this is I have a database that I manage the contents, and it has a field that either has plain text, a phone number, a URL or an email address.  I was looking for an easy way to validate the input so I can have it properly formatted, ie. creating anchor tags for the url/email, and formatting the phone number how I have the other numbers formatted throughout the site.  Any suggestions?</p>