Re: [go-nuts] Why the limit on regex repeat is 1000?

2021-06-06 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-06-06 at 18:14 +1000, Rob Pike wrote: > You are using a steamroller to press a shirt. Tomi Ungerer has already published this approach. https://kotonoha-books.ocnk.net/data/kotonoha-books/product/20160619_70ddf5.JPG -- You received this message because you are subscribed to the

Re: [go-nuts] Why the limit on regex repeat is 1000?

2021-06-06 Thread Rob Pike
It is to protect the regexp engine from overly expensive computations, as the repetition can introduce quadratic behavior in the compiler. The Go engine is concerned about pathological execution - not all engines have this property (see https://swtch.com/~rsc/regexp/regexp1.html) - and is being

[go-nuts] Why the limit on regex repeat is 1000?

2021-06-06 Thread M Hasbini
Playground: https://play.golang.org/p/opVpDD5Ts8S Here's an example regex that fails to compile: `[a-zA-Z0-9]{1001,}` Here's where the 1000 is specified: https://github.com/golang/go/blob/4d9ecde/src/regexp/syntax/parse.go#L250 Other languages regex engine behavior: The regex is valid on all