pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Merrill <andrew@compclass.com>
To: pgsql-sql@hub.org
Subject: regexp strangeness
Date: Tue, 30 Mar 1999 09:44:09 -0800
Message-ID: <37010D69.6D1868ED@compclass.com> (raw)

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




Message-ID: <37010D69.6D1868ED@compclass.com>
Permalink:  ../37010D69.6D1868ED@compclass.com/
Also on:    postgresql.org/message-id/37010D69.6D1868ED@compclass.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: andrew@compclass.com, pgsql-sql@hub.org
  Subject: Re: regexp strangeness
  In-Reply-To: <37010D69.6D1868ED@compclass.com>
  References: <37010D69.6D1868ED@compclass.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox