Re: Pathological regexp match - Mailing list pgsql-hackers

From Michael Glaesemann
Subject Re: Pathological regexp match
Date
Msg-id 9B3645EE-2DC2-4379-AC00-B71F8C5D3E55@myyearbook.com
Whole thread Raw
In response to Re: Pathological regexp match  (Alvaro Herrera <alvherre@commandprompt.com>)
List 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
michael.glaesemann@myyearbook.com





pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Pathological regexp match
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: out-of-scope cursor errors