Re: Regexp matching: bug or operator error?
| От | Tom Lane |
|---|---|
| Тема | Re: Regexp matching: bug or operator error? |
| Дата | |
| Msg-id | 1713.1101254499@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Regexp matching: bug or operator error? (Ken Tanzer <ktanzer@desc.org>) |
| Ответы |
Re: Regexp matching: bug or operator error?
|
| Список | pgsql-general |
Ken Tanzer <ktanzer@desc.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
В списке pgsql-general по дате отправления: