public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Ken Tanzer <[email protected]>
Cc: [email protected]
Subject: Re: Regexp matching: bug or operator error?
Date: Tue, 23 Nov 2004 19:01:39 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Ken Tanzer <[email protected]> writes:
> Using Postgres V. 7.4.1, the following query:
> SELECT substring('X12345X' FROM '.*?([0-9]{1,5}).*?');
> Returns '1'. I would expect it to return '12345'. Is this a bug, or am
> I missing something? Thanks.
Hmm ... playing with it, it seems that there may indeed be a bug here
... it's acting like the "non greedy" flag from the .*? is being applied
to the {m,n} as well. In other words the behavior would be correct for
SELECT substring('X12345X' FROM '.*?([0-9]{1,5}?).*?');
However, aren't you doing this the hard way? Why not just
SELECT substring('X12345X' FROM '([0-9]{1,5})');
regards, tom lane
view thread (12+ messages) latest in thread
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Regexp matching: bug or operator error?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox