On Sun, 1 Nov 2020 11:39:55 -0800 Jim Meyering <j...@meyering.net> wrote:
> We must accept the fact that extreme regular expressions will cause > resource exhaustion like that when processed by classical regex_* > functions. This is yet another good reason to prefer PCRE and to use > grep's -P option. In that case, it fails like this: > > $ printf '(%080000d)\n' | sed 's/0/|/g' |grep -Pf- /dev/null > grep: regular expression is too large > > I have just pushed your patch, but without adding a test. I also investigated the slowdown, and I reached the same view as you. The regex consumes a lot of memory for patterns with normous epsilon closures.