posix style regexp?

Поиск
Список
Период
Сортировка
От Cindy
Тема posix style regexp?
Дата
Msg-id 21806.1032372777@stephanus.tlg.uci.edu
обсуждение исходный текст
Ответы Re: posix style regexp?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@uci.edu

В списке pgsql-general по дате отправления:

Предыдущее
От: Eric D Nielsen
Дата:
Сообщение: Permissions with multiple groups...
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Automatic Indexes from Query Optimization?