title: Regular Expression validate URL in perl
body: <p>I'm trying to finish up my assignment and only last one is to validate the URL</p>
  
  <p>The requirement is as follow:</p>
  
  <p>url only allows alphanumerical characters and the following  :/.~?=+&amp;    No two periods can exist consecutively. </p>
  
  <p>here is what I have so far but it doesn't work</p>
  
  <pre><code>m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|
  </code></pre>
  
  <p>So what happen now that anything I enter it just pass the matching process that I do which is something like this</p>
  
  <pre><code>$return = $search =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
  </code></pre>
  
  <p>so it always return true for me even I just type nothing in the search box.</p>