Regualer expressions

From: David A Dickson <davidd(at)saraswati(dot)wcg(dot)mcgill(dot)ca>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Regualer expressions
Date: 2002-06-17 18:34:20
Message-ID: Pine.LNX.4.33.0206171433001.1047-100000@blues.wcg.mcgill.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sorry, messed up the subject.

On Mon, 17 Jun 2002, David A Dickson wrote:

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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2002-06-17 18:43:58 Re: Clients for administration?
Previous Message Marc G. Fournier 2002-06-17 18:12:22 Re: jobs.postgresql.org - Who's interested?