On Mon, Dec 15, 2014 at 8:04 PM, Jens Alfke <j...@mooseyard.com> wrote:
>
>
> Anyway, please file a bug report with Apple, as this seems to be a bug in
> NSRegularExpression.
>

Done!

I'm no expert on regular expressions, but my understanding is that all the
> implementations have a couple of pathological conditions where for certain
> expressions the memory usage goes up rapidly with input length, and if you
> run into one of those you'll need to adjust your expression to work around
> it.
>

I'm also no expert on regexps but I thought that the pathological
conditions are met when using back-references (which I don't use). In any
case, I tried it in JavaScript and it works up to 10 000 000 characters (I
didn't try more).

var pattern = /(1+)|(2+)|(3+)|(4+)|(5+)|(6+)|(7+)|(8+)|(9+)|(0+)|(a+)/;
var result = pattern.exec(new Array(10000001).join("a"));
console.log(result.index, result[0].length);

Thanks again for all the replies!
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to