Skip site navigation (1) Skip section navigation (2)

Re: Pathological regexp match

From: Michael Glaesemann <michael(dot)glaesemann(at)myyearbook(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Pathological regexp match
Date: 2010-01-29 04:36:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Jan 28, 2010, at 23:21 , Alvaro Herrera wrote:

> I think the reason for this is that the first * is greedy and thus the
> entire expression is considered greedy.  The fact that you've made the
> second * non-greedy does not ungreedify the RE ... Note the docs say:
> 	The above rules associate greediness attributes not only with
> 	individual quantified atoms, but with branches and entire REs
> 	that contain quantified atoms. What that means is that the
> 	matching is done in such a way that the branch, or whole RE,
> 	matches the longest or shortest possible substring as a whole.

Interesting. Thanks for pointing out this section of the docs. I  
wasn't aware of this twist.

> It's late here so I'm not sure if this is what you're looking for:

I'm not actually looking for a regexp that works: I was able to  
accomplish the task I had at hand with a different regexp. I'm just  
reporting the particular unexpected nastiness we ran into. :)

Michael Glaesemann

In response to

pgsql-hackers by date

Next:From: Boszormenyi ZoltanDate: 2010-01-29 05:32:20
Subject: Re: out-of-scope cursor errors
Previous:From: Alvaro HerreraDate: 2010-01-29 04:21:42
Subject: Re: Pathological regexp match

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group