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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…