Author: Philip Hazel Date: To: David CC: pcre-dev Subject: Re: [pcre-dev] PCRE Bug
On Mon, 30 Mar 2009, David wrote:
> I am using this regular expression, which is causing problems:
>
> /<$element *(.*)>(.*)<\/$element>/iU
>
> where $element is replaces, such as:
>
> /<a *(.*)>(.*)<\/a>/iU
>
>
> It works fine, but after a number of recursions I am getting a seg
> fault.
>
> I think its got something to do with the part ' *' as it was not seg
> faulting until I added this.
What is the subject string that you are trying to match? Without that,
there is no way that I can run any sensible tests. I do not use PHP, so
any testing I do will use the pcretest program.
My *guess* is that you are feeding this pattern a very long string that
does not match, and it is doing a lot of backtracking. This might use
more stack than is available. Have you tried using ' *+' instead of just
' *'?