REGEXP_REPLACE : How to use a column value in the regex

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: abdulrahim(dot)s(at)gmail(dot)com
Subject: REGEXP_REPLACE : How to use a column value in the regex
Date: 2020-02-17 06:37:11
Message-ID: 158192143115.6745.7931715775932027756@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/functions-matching.html
Description:

The documentation doesn't talk about any regex syntax for using a column
from the db in the pattern. There is no mention if this is NOT supported.
All the examples are using static string and none using a DB column
values.
e.g. I have a field *portfolio* which had data like CloudPlatform (Public),
CloudPlatform (Private), MobilePlatfom (Public),.. etc
These values are coming from another table *platformtypes" which has these
values Public, Private, Hybrid...etc.
I want to replace these types from the portfolio names, i was able to do it
using string
*SELECT
Portfolios.PortfolioName,REGEXP_REPLACE(Portfolios.PortfolioName,'(\(Public\))',''),
but I would like to use something like
*REGEXP_REPLACE(Portfolios.PortfolioName,'(\(platformtypes.Name\)),'')*

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David Zhang 2020-02-18 20:26:43 Re: First WAL segment file that initdb creates
Previous Message Alexander Lakhin 2020-02-16 21:21:24 Re: Getting our tables to render better in PDF output