From: | Thom Brown <thom(at)linux(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: regex help wanted |
Date: | 2013-04-25 14:40:51 |
Message-ID: | CAA-aLv6YfKbhhzsRz==mFGkweTF4C7ghQS+qnbAs7CDd8FAgUQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 25 April 2013 15:32, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)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.
--
Thom
From | Date | Subject | |
---|---|---|---|
Next Message | Karsten Hilbert | 2013-04-25 14:45:09 | Re: regex help wanted |
Previous Message | Tom Lane | 2013-04-25 14:32:26 | Re: regex help wanted |