Regex to match pattern with subdomain in java gives issues
Posted
by
Ramesh
on Stack Overflow
See other posts from Stack Overflow
or by Ramesh
Published on 2012-09-16T09:34:07Z
Indexed on
2012/09/16
9:37 UTC
Read the original article
Hit count: 208
I am trying to match the sub domain of an url using http://([a-z0-9]*.)?example.com/.*
which works perfectly for these cases.
http://example.com/index.html
http://test.example.com/index.html
http://test1.example.com/index.html
http://www.example.com/122/index.html
But the problem is it matches for this URL too. http://www.test.com/?q=http://example.com/index.html
if an URL with another domain has the URL in path it matches.Can any one tell me how to match for current domain only. getting the host will work but i need to match full URL.
© Stack Overflow or respective owner