pcre, bifs, drivers and ports

Bjorn Gustavsson bjorn@REDACTED
Wed Aug 2 09:51:00 CEST 2006


Mats Cronqvist <mats.cronqvist@REDACTED> writes:

>    for our immediate problem, it is ok to limit the size of the regexp.
> 

If you by size means the length of the regexp string, this is a very
poor measure of how fast or slow the regexp matching will be.

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.

An heuristic that might work would be to disallow regexps with more
than one closure operator. Or to only allow more than one star operator
if the string is reasonably short. (Note that regexps are quity tricky
to parse, as stars can be escaped or within character classes; thus,
counting the number of stars in the regexp string is not enough.)

/Bjorn
-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list