regexp strangeness

Поиск
Список
Период
Сортировка
От Andrew Merrill
Тема regexp strangeness
Дата
Msg-id 37010D69.6D1868ED@compclass.com
обсуждение исходный текст
Список pgsql-sql
I'm using PostgreSQL 6.4.2 regexps, and they don't seem to work the way
I'm used to (Perl).

Here's the records in a simple table:

select * from t5 where name ~ 'bar';
name
--------
bar
abar
xbar
not abar
(4 rows)

I'd like to match the ones that begin with 'bar' or 'abar'.

select * from t5 where name ~ '^a?bar';
name
----
abar
(1 row)

select * from t5 where name ~ '^bar|^abar';
name
----
(0 rows)

Neither of these works.  I looked at
pgsql/src/backend/regex/re_format.7, and it claims that ^, ?, and | all
work as expected.  The type of name is varchar(30), in case that is
relevant.

Am I misunderstanding PostgreSQL's use of regexps, or is this a bug
others have seen?

Thanks for your help.

Andrew Merrill



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

Предыдущее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [SQL] indexing a datetime by date
Следующее
От: Andrew Merrill
Дата:
Сообщение: Re: [SQL] indexing a datetime by date