I have tried all the things like regexp ,substring for getting domain name from uri 'http://start.readingresults.com/RapidResults/vocab_web_alt/reviewResponseAjax.do' but failed to get accurate result.It should show me www.start.readingresults.com.Somatimes uri includes ip address which make me this thing more complex.Such as 192.168.1.10 etc. Which is more proper way to find domain regexp or substring?
-
Why don't you save the domain name and URI separately?errieman– errieman2013-04-12 09:28:40 +00:00Commented Apr 12, 2013 at 9:28
-
1What's your programming language? Try to look for '//' then look for first '/' then everything between indexOf("//") and indexof('/') is the domainAlepac– Alepac2013-04-12 09:46:20 +00:00Commented Apr 12, 2013 at 9:46
Add a comment
|
1 Answer
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('http://start.readingresults.com/RapidResults/vocab_web_alt/reviewResponseAjax.do', '//', -1),'/',1);
if your URL having ip address means you have to handle in separate way using SUBSTRING_INDEX
Here the sqlfiddle.
Cheers...