Re: Postgres DB recompilation

From: David A Dickson <davidd(at)saraswati(dot)wcg(dot)mcgill(dot)ca>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres DB recompilation
Date: 2002-06-17 16:04:55
Message-ID: Pine.LNX.4.33.0206171158460.399-100000@blues.wcg.mcgill.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am trying to do an update using regular expressions. Is something
like this possible?

a=# select path from page where path ~ '/academic-staff/reports/(.*$)';
path
--------------------------------------
/academic-staff/reports/agriculture/
/academic-staff/reports/arts/
/academic-staff/reports/education/
/academic-staff/reports/engineering/
/academic-staff/reports/medicine/
/academic-staff/reports/music/
/academic-staff/reports/science/
/academic-staff/reports/

a=# update page set path = '/academic-staff/fooreports/\1'
where path ~ '/academic-staff/reports/(.*$)';

What I'm trying to do is replace all occurances of
/academic-staff/reports/(.*$) with
/academic-staff/fooreports/\1
where \1 is everything that was matched by the .*$

can it be done? anyone know how?

--
David A Dickson
david(dot)dickson(at)mail(dot)mcgill(dot)ca

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message terry 2002-06-17 16:43:49 Re: create definiton
Previous Message Henrik Steffen 2002-06-17 15:52:59 Re: Serious Crash last Friday