Re: regex help wanted

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: regex help wanted
Дата
Msg-id 20130425144612.GJ3802@hermes.hilbert.loc
обсуждение исходный текст
Ответ на Re: regex help wanted  (Thom Brown <thom@linux.com>)
Список pgsql-general
On Thu, Apr 25, 2013 at 03:40:51PM +0100, Thom Brown wrote:

> On 25 April 2013 15:32, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Karsten Hilbert <Karsten.Hilbert@gmx.net> writes:
> >> What I don't understand is: Why does the following return a
> >> substring ?
> >
> >>       select substring ('junk $<allergy::test::99>$ junk' from '\$<[^<]+?::[^:]+?>\$');
> >
> > There's a perfectly valid match in which [^<]+? matches allergy::test
> > and [^:]+? matches 99.
>
> Yeah, I think there may be an assumption that a lazy quantifier will
> stop short and cause the remainder to fail to match permanently, but
> it will backtrack, forcing the lazy quantifier to expand until it can
> match the expression.

Yup, therein lies the rub :-)

Thanks,
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


В списке pgsql-general по дате отправления:

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: Re: regex help wanted
Следующее
От: Tom Lane
Дата:
Сообщение: Re: regex help wanted