title: Check for valid link (URL)
body: <p>I was reading though this <a href="https://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url">other question</a> which has some really good regex's for the job but as far as I can see non of them work with BASH commands as BASH commands don't support such complex rexeg's.</p>
  
  <pre><code>if echo "http://www.google.com/test/link.php" | grep -q '(https?|ftp|file)://[-A-Z0-9\+&amp;@#/%?=~_|!:,.;]*[-A-Z0-9\+&amp;@#/%=~_|]'; then 
      echo "Link valid"
  else
      echo "Link not valid"
  fi
  </code></pre>
  
  <p>But this doesn't work as grep -q doesn't work ...</p>
  
  <p><b>Edit</b>, ok I just realised that grep had an "extended-regex" (-E) option which seems to make it work. But if anyone has a better/faster way I would still love to here about it.</p>