1

Possible Duplicate:
Validate email address in Javascript?
What is the best regular expression to check if a string is a valid URL?

I want to test that whether the string is url or not, right now I am stuck at this point. I am using this regex to validate my URL /(https|http):\/\/([_a-z\d\-]+(\.[_a-z\d\-]+)+)(([_a-z\d\-\\\.\/]+[_a-z\d\-\\\/])+)*/;

The problem with this regex is that it fails to validate this type of URL

http://www.abc/abc/

how to check that case.?

8
  • See stackoverflow.com/questions/8667070/… and stackoverflow.com/questions/1303872/… Commented Oct 8, 2012 at 13:37
  • 1
    duplicate of this, this, this, this... Commented Oct 8, 2012 at 13:37
  • Just for the sake of simplicity, \w catches [a-zA-Z0-9_]. Commented Oct 8, 2012 at 13:39
  • I gone through the above links.. but my problem is that the regex i ma using is fine but if i remove .com or .in anything it also consider it a valid URL.. Commented Oct 8, 2012 at 13:40
  • Shouldn't it validate http://site.com/abc/, for example? Commented Oct 8, 2012 at 13:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.