[pcre-dev] [Bug 872] Failed to match

Página Principal
Apagar esta mensagem
Autor: Philip Hazel
Data:  
Para: pcre-dev
Assunto: [pcre-dev] [Bug 872] Failed to match
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=872




--- Comment #1 from Philip Hazel <ph10@???> 2009-08-03 18:29:29 ---
On Mon, 3 Aug 2009, Mike wrote:

> text to match = "   th     is     i s   a   t e s  t     "

>
> regexp1 =
> "(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.|\n)(.*\n*)*(.|\n)"
>
> regexp2="(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.|\n)(.*\n*)*(.*\n*)*(.|\n)"
>
> Results:
> regexp1 is failed to match the text. (FAIL)
> regexp2 successfully matches the text.(OK)
>
> Expected results:
> both regual expressions should succefully match the text.
>
> Reproduced at version 7.9.


So have I, but it's not a bug (I put the data a file called "zz"):

-----------------------------------------------------------------------
$ pcretest zz
PCRE version 7.9 2009-04-11

"(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.|\n)(.*\n*)*(.|\n)"
   th     is     i s   a   t e s  t     
Error -8
-----------------------------------------------------------------------



Error -8 is PCRE_ERROR_MATCHLIMIT (and it takes an noticeable time to
give this). This is the second report in a week of a similar problem.
Note that nested unlimited repeats can easily give this problem. Please
read the "pcreperform" man page.

Using pcretest's -M option, I get (after about a minute):

-----------------------------------------------------------------------
$ pcretest -M zz
PCRE version 7.9 2009-04-11

"(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.|\n)(.*\n*)*(.|\n)"
   th     is     i s   a   t e s  t     
Minimum match() limit = 10321961
Error -8


"(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.*\n*)*(.|\n)(.*\n*)*(.*\n*)*(.|\n)"
   th     is     i s   a   t e s  t     
Minimum match() limit = 5455913
Minimum match() recursion limit = 75
-----------------------------------------------------------------------



The default match limit is 10000000, enough for the second pattern, but
not enough for the first.

Regards,
Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email