pcre, bifs, drivers and ports

Robert Virding robert.virding@REDACTED
Thu Aug 3 13:11:57 CEST 2006


Mats Cronqvist wrote:
> Luke Gorrie wrote:
>>   2> regexp:match("foo", "f**").
>>
>>   Crash dump was written to: erl_crash.dump
>>   eheap_alloc: Cannot allocate 1781763260 bytes of memory (of type 
>> "heap").
>>   Aborted
>>
>> .. death while trying to find the longest match with zero-or-more 
>> nothings.
>>
>> I've often wondered if there's a simple fix for this that doesn't take
>> away the cute simplicity of the regexp matcher.
> 
>   pcre deals with that like this;
> 
> 1> re:grep("foo",["f**"]).
> [{error,{"nothing to repeat",2}}]

While the handling of "f**" in regexp is definitely a bug, which I 
suppose I should fix, it is definitely a legal regular expression. So 
that pcre will not even allow the regular expression is also a bug, the 
question is if it is the parsing of the expression or where?

If you are as "cautious" as people working with cryptography you would 
start wondering if this is sign of a deeper malaise. :-)

As the great Cato said: I still feel that calling the function grep is 
misleading.

Could someone send a real problem to experiment on? Especially one which 
the current regexp module is definitely too slow on.

Robert




More information about the erlang-questions mailing list