D 1.0: std.regexp incredibly slow!

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue Sep 22 13:31:43 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 admit my regex-fu is weak (especially for PCRE), but doesn't $ match
end of line, making \r?\n? unnecessary or even causing the thing to
match one line with a bunch of stuff followed by an empty line?

If you take \r?\n? out, RegExp performs considerably faster, though I
couldn't say what implications it would have on what you're using it for.



More information about the Digitalmars-d mailing list