<p>I'm looking for a regex that will allow me to validate whether or not a string is the reference to a website address, or a specific page in that website. </p>

<p>So it would match:</p>

<pre><code>http://google.com
ftp://google.com
http://google.com/
http://lots.of.subdomains.google.com
</code></pre>

<p>But not:</p>

<pre><code>http://google.com/search.whatever
ftp://google.com/search.whatever
http://lots.of.subdomains.google.com/search.whatever
</code></pre>

<p>Any ideas? I can't quite figure out how to handle allowing the <code>/</code> at the end of the URL.</p>

Try this:
```
```
(http|ftp|https)://([a-zA-Z0-9\-\.]+)/?
```
```