Re: NSRegularExpression segfault
Re: NSRegularExpression segfault
- Subject: Re: NSRegularExpression segfault
- From: ecir hana <email@hidden>
- Date: Mon, 15 Dec 2014 22:17:03 +0100
On Mon, Dec 15, 2014 at 8:04 PM, Jens Alfke <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden