Re: [SQL] regexp_replace and search/replace values stored in table

2010-05-02 Thread Sofer, Yuval
-4286-282 yuval_so...@bmc.com -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Leif Biberg Kristensen Sent: Saturday, May 01, 2010 8:29 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] regexp_replace and search/replace values

Re: [SQL] regexp_replace and search/replace values stored in table

2010-05-01 Thread Leif Biberg Kristensen
Followup II: I've written a blog post on the subject at . regards, -- Leif Biberg Kristensen http://solumslekt.org/ -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-s

Re: [SQL] regexp_replace and search/replace values stored in table

2010-04-27 Thread Leif Biberg Kristensen
Followup. Replaced Big Ugly Function with: CREATE OR REPLACE FUNCTION _my_expand(TEXT) RETURNS TEXT AS $$ -- private func, expand various compact links DECLARE str TEXT = $1; links RECORD; BEGIN FOR links IN SELECT short_link, long_link FROM short_links LOOP str := REGEXP_REPL

Re: [SQL] regexp_replace and search/replace values stored in table

2010-04-27 Thread Leif Biberg Kristensen
On Tuesday 27. April 2010 13.43.48 Leif Biberg Kristensen wrote: > CREATE TABLE short_links ( > link_type CHAR(2) PRIMARY KEY, > short_link TEXT, > long_link TEXT, > description TEXT > ); > > It appears like I have to double the number of backslashes when I enter the > data: > >

Re: [SQL] regexp_replace and search/replace values stored in table

2010-04-27 Thread Leif Biberg Kristensen
On Tuesday 27. April 2010 15.04.23 Tim Landscheidt wrote: > Leif Biberg Kristensen wrote: > > > [...] > > So far, so good. But when I try to do the actual expansion, I'm stumped. > > > pgslekt=> select regexp_replace((select source_text from sources where > > source_id=23091), (select quote_lite

Re: [SQL] regexp_replace and search/replace values stored in table

2010-04-27 Thread Tim Landscheidt
Leif Biberg Kristensen wrote: > [...] > So far, so good. But when I try to do the actual expansion, I'm stumped. > pgslekt=> select regexp_replace((select source_text from sources where > source_id=23091), (select quote_literal(short_link) from short_links where > link_type = 'sk'), (select quot