I'm trying to write a sql or plpgsql function update_nametags(TEXT, TEXT)
which does a replace on this form:
UPDATE sources SET source_text = regexp_replace(source_text,
E'n="(.*?)$1(.*?)"', E'n="\\1$2\\2"', 'g') where source_text like
'%n="%$2%">%';
But I can't find out how to escape the parameters $1 and $2. I've also tried to
wrap it in an EXECUTE and concatenate the parameters with no luck.
I'd also like to have the function return the number of affected rows.
regards, Leif