Use regexp_replace when are dots at the text

Viewed 23

I'm trying to use regexp_replace to clean all ".com/.net/..." url ends (there's a list of texts I need to filter) from a column of text type, but I don't get success,


I got stucked at the following query:

SELECT id, url, regexp_replace(url, '.com|.net', '', 'g')
from companies;

Sometimes it gets more characters than it should. Eg:

 1831 | network_company.net | work_company

It should return network_company, because I wrote .com, with a dot at the expression.

0 Answers
Related