0

I have one table pages which has url field. I want to filter those records by domain name. Below are the sample domains from list of URL.

I checked this answer. But REGEXP_REPLACE is not working in where condition.

Below is the query that I tried but it is only allowing to filter by hostname, I want regex which work for the domain name.

Page.where("substring(url from '.*://([^/]*)') in (?)", ['test.host'])

The request parameter for domains will be ['http://test.host'] not ['test.host'].

I am looking for the best solution to tackle this problem. Thank you in advance.

2
  • This is a potential duplicate of stackoverflow.com/questions/21173734/… Commented Apr 22, 2020 at 11:33
  • @max I think you didn't get my question. I want a full domain with the scheme. Currently what i missing is scheme part and above question is not matching anywhere. Commented Apr 22, 2020 at 12:47

0

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.