X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 771973A3C6B for ; Wed, 24 Nov 2004 00:21:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03887-01 for ; Wed, 24 Nov 2004 00:20:57 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 23EF03A41A9 for ; Wed, 24 Nov 2004 00:20:57 +0000 (GMT) Received: from wp2000 ([157.157.176.239] [157.157.176.239]) by quasar.skima.is; Wed, 24 Nov 2004 00:20:56 Z Message-Id: <01c601c4d1bb$d4df25a0$0100000a@wp2000> From: "gnari" To: "Ken Tanzer" , References: <41A3C6C6.2090605@desc.org> Subject: Re: Regexp matching: bug or operator error? Date: Wed, 24 Nov 2004 00:23:33 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/1146 X-Sequence-Number: 69226 From: "Ken Tanzer" > 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. the results of mixing greedy and non-greedy repetitions can be difficult to predict. try SELECT substring('X12345X' FROM '\\D*(\\d{1,5}).*?'); gnari