0

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?

2
  • Why don't you save the domain name and URI separately? Commented Apr 12, 2013 at 9:28
  • 1
    What's your programming language? Try to look for '//' then look for first '/' then everything between indexOf("//") and indexof('/') is the domain Commented Apr 12, 2013 at 9:46

1 Answer 1

2
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...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.