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