From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ken Tanzer <ktanzer(at)desc(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Regexp matching: bug or operator error? |
Date: | 2004-11-24 00:01:39 |
Message-ID: | 1713.1101254499@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-general |
Ken Tanzer <ktanzer(at)desc(dot)org> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-11-24 00:15:18 | Re: Regexp matching: bug or operator error? |
Previous Message | Thomas Hallgren | 2004-11-23 23:41:26 | Re: Regexp matching: bug or operator error? |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-11-24 00:15:18 | Re: Regexp matching: bug or operator error? |
Previous Message | Hunter Hillegas | 2004-11-23 23:56:59 | Copying into Unicode - Correcting Errors |