Regular expression for checking website url
- by Linto davis
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 should accept 1st and 3rd option too