D 1.0: std.regexp incredibly slow!
Markus Dangl
danglm at in.tum.de
Tue Sep 22 14:14:47 PDT 2009
Ellery Newcomer schrieb:
> 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.
In this case $ matches end of subject, i.e. the end of the string. I
assume there is an option for making it match at end-of-line. (At least
thats the way it works in PCRE).
More information about the Digitalmars-d
mailing list