Regex to test if homepage?

I need a regex that identifies only a homepage. For example https://www.mydomain.com or http://www.mydomain.com. if there is any path after this, it has to fail. Although http(s)://www.mydomain.com/ is acceptable.

Thanks
894359Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SSupremeCommented:
0
Dave BaldwinFixer of ProblemsCommented:
What about http://www.mydomain.com/index.html which is also the home page on many sites?
0
SSupremeCommented:
No, It isn't. Try http://www.experts-exchange.com/index.html
/ is a call of default website file and otherwise the list would continue
index.htm
index.shtml
index.php
index.php5
index.php4
index.php3
index.cgi
default.html
default.htm
home.html
home.htm
Index.html
Index.htm
Index.shtml
Index.php
Index.cgi
Default.html
Default.htm
Home.html
Home.htm
placeholder.html
....aspx
0
Make Network Traffic Fast and Furious with SD-WAN

Software-defined WAN (SD-WAN) is a technology that determines the most effective way to route traffic to and from datacenter sites. Register for the webinar today to learn how your business can benefit from SD-WAN!

Dave BaldwinFixer of ProblemsCommented:
@SSupreme, you just made my point exactly.  Besides... I said 'many' sites, not all sites.
0
894359Author Commented:
Sorry... what if there is a query string?  http://www.mydomain.com/?a=b or  http://www.mydomain.com?a=b  Just thought about this!
0
SSupremeCommented:
What do you what to do? My regex doesn't allow it.
0
894359Author Commented:
But what is there is a query string? I don't care about things like "index.html" but I do care about query strings!
0
SSupremeCommented:
Do you what to allow query string?
0
894359Author Commented:
yes I do want to allow query strings.

Thank you!
0
SSupremeCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
894359Author Commented:
That worked! Thank you!  ^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/|\?.+\=.+)?(\?.+\=.+)?$
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.