Reputation: 129
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?
Upvotes: 0
Views: 270
Reputation: 1069
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...
Upvotes: 2