D 1.0: std.regexp incredibly slow!

Jeremie Pelletier jeremiep at gmail.com
Tue Sep 22 13:08:35 PDT 2009


Markus Dangl wrote:
> Hi *,
> 
> i stumbled on what seems to be a bug in std.regexp: It is incredibly
> slow using the following pattern:
> RegExp("^\\s+(\\d+)\\s+(\\d+)\\s+\\w+\\s+(\\w+)\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+(.*)\r?\n?$")
> 
> I don't really get the regexp code, so i can't debug it myself, but i
> have a PHP (!!) script that executes the same regexp in milliseconds.
> 
> I attached code to test it, can someone please confirm?
> 
> Thanks,
> Markus
> 
> PS: Is there a quick way to fix this or are there bindings for other
> RegExp libs that i can use (Linux and Windows required) - i need to fix
> my program soon :) atm i'm looking for workarounds (splitting it into
> small regexps).
> 

You could write your own bindings to PCRE and use that, since its what 
PHP uses. Maybe someone on dsource already did it too.



More information about the Digitalmars-d mailing list