pcre, bifs, drivers and ports

Luke Gorrie luke@REDACTED
Wed Aug 2 15:23:40 CEST 2006

Bjorn Gustavsson <bjorn@REDACTED> writes:

> For instance, a long literal string is quite fast to match. An regexp
> that uses the star (closure) operator, and especially multiple star
> operators *can* be very slow. It depends on what the rest of the regexp
> looks like and how clever the regexp engine is.

Yes. Extreme example:

  2> regexp:match("foo", "f**").

  Crash dump was written to: erl_crash.dump
  eheap_alloc: Cannot allocate 1781763260 bytes of memory (of type "heap").

.. 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.

More information about the erlang-questions mailing list