I want to achieve below results with the help of Regular Expression
-
http://articles-test.mer.com --> should not match/accept or return false
http://articles-test.mer.com/ --> should not match/accept or return false
http://articles-test. mer.com/ --> should not match/accept or return false
http://articles-test. mer.com/sites --> should not match/accept or return false
http://articles-test.mer.com/sites --> should match/accept or return true
http://foodfacts.merc.com/green-tea.html --> should match/accept or return true
http://articles-test.merc.com/sites/abc.aspx --> should match/accept or return true
Conclusion- In Short if the URL
has only domain
, it should not match/accept
I've tried with the below expression
but it is not working as expected -
^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?])?$
Please suggest and Thanks in advance!