[erlang-questions] Improved regexp.erl

Robert Virding <>
Wed Oct 25 22:48:14 CEST 2006

I have added a new version of regexp.erl which contains the earlier 
mentioned patches to trapexit.org. Same thread in User contributions.

I have also done some simple benchmarking on a 1.7 GHz laptop. I have 
done regexp:matches/1, i.e. return a list of all non-overlaping matches, 
on a 1 M element list (1 Mbfile) containing repeated copies of 
erlog_int.erl. For the pattern "[a-z]+_[a-z]", which returns over 
_14000_ matches, this took about 0.5 sec, including building the list. 
It is a simple pattern but tests quite alot.

The test was done using the regexp:compile/1 option in the new regexp as 
well as a prototyp of regexp_transform which builds specialised code for 
each regexp. The compile/1 was about 10% slower.

I think this is fast enough to be useful. I plan to write a version for 
binaries and will return when that is done.

What requirements do people have?


Yariv Sadan wrote:
> Hi Robert,
> Thanks for the new regexp module! Have you ran any benchmarks
> comparing its performance to the old module? Also, I remember your
> mentioning it would be able to work with binaries. Is that capability
> implemented?
> Thanks
> Yariv
> On 10/17/06, Robert Virding <> wrote:
>> I have added an upgraded, drop-in replacement to the user contributions
>> in trapexit.org. It allows for compilation of regular expressions. They
>> can either be used directly in the functions in the module, as with
>> regexp:parse, or the DFA built from the regexps can be returned. Read
>> the documentation.
>> Robert
>> _______________________________________________
>> erlang-questions mailing list
>> http://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list