| From: | Andrew Merrill <andrew(at)compclass(dot)com> | 
|---|---|
| To: | pgsql-sql(at)hub(dot)org | 
| Subject: | regexp strangeness | 
| Date: | 1999-03-30 17:44:09 | 
| Message-ID: | 37010D69.6D1868ED@compclass.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Merrill | 1999-03-30 18:11:19 | Re: [SQL] indexing a datetime by date | 
| Previous Message | Jackson, DeJuan | 1999-03-30 17:33:46 | RE: [SQL] indexing a datetime by date |