I need to check the web address, using regular expression.
If user type URL as
www.test.com
http://www.test.com
https://www.test.com
I have a regular expression like
/^(http\:\/\/[a-zA-Z0-9_\-]+(?:\.[a-zA-Z0-9_\-]+)*\.[a-zA-Z]{2,4}(?:\/[a-zA-Z0-9_]+)*(?:\/[a-zA-Z0-9_]+\.[a-zA-Z]{2,4}(?:\?[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?)?(?:\&[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)*)$/
but it will only allow the second option only. How can I modify the regular expression so, that it accepts 1st and 3rd option too?