posix style regexp?

From: Cindy <ctmoore(at)uci(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: posix style regexp?
Date: 2002-09-18 18:12:57
Message-ID: 21806.1032372777@stephanus.tlg.uci.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I've a question about escaping special characters in a ~ string operation.
To match the literal ? I would have thought I could put in \?
but this seems not to work.

Examples:
Text=# SELECT byteloc, citation FROM citations WHERE aid = 1262::smallint AND wid = 2::smallint AND citation ~ 'y"335?"z[0-9]+';
byteloc | citation
---------+----------
(0 rows)
Text=# SELECT byteloc, citation FROM citations WHERE aid = 1262::smallint AND wid = 2::smallint AND citation ~ 'y"335\?"z[0-9]+';
byteloc | citation
---------+----------
(0 rows)
Text=# SELECT byteloc, citation FROM citations WHERE aid = 1262::smallint AND wid = 2::smallint AND citation ~ 'y"335."z[0-9]+';
byteloc | citation
---------+-----------
160 | y"335?"z1
215 | y"335?"z2
276 | y"335?"z3
341 | y"335?"z4
410 | y"335?"z5
467 | y"335?"z6
530 | y"335?"z7
(7 rows)

Thanks,
--Cindy
--
ctmoore(at)uci(dot)edu

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2002-09-18 19:07:30 Re: Automatic Indexes from Query Optimization?
Previous Message Eric D Nielsen 2002-09-18 17:09:44 Permissions with multiple groups...