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@uci.edu