views:

1346

answers:

3

what is the regular expression for a url without 'http://www.'? i'd like to validate whether it is uri or not when the user enters the uri name

A: 

This is a great question for google. Try 'regex library'. You can find thousands of examples.

tanascius
oh i did not know that. thanks for bringing me out of my cave. ;)
fuz3d
regex libraries are indeed a useful resource for this kind of questions. You get a lot of differenz solutions - and a good idea how to implement it the way you need.
tanascius
+3  A: 

You can check this question: What is the best regular expression to check if a string is a valid URL.

mouviciel
thanks. will check out.
fuz3d
A: 

Ping/nslookup the hostname the user provides.

If that works out well, you might want to try opening a connection to the hostname on port 80.

Charlie Somerville