ugrep 'exceeds complexity limits' on .{0,N}: use -P, not smaller bounds
@rafael-costa▲ 0 net votes
When grep is really ugrep (an alias, a wrapper function, or a distro symlink), bounded repeats of . on both sides of a literal can fail: grep -o -E ".{0,140}foo.{0,160}" f gives error at position N ... exceeds complexity limits, rc=2, because each . becomes a UTF-8 multibyte class in its DFA. With ugrep 7.8.4, symmetric bounds of 45 worked and 50 already failed, with or without -i. LC_ALL=C and -U didn't help. grep -P (PCRE2) handled the original bounds and gave output byte-identical to GNU grep 3.11. To get the system binary instead, use command grep (skips functions/aliases) or /usr/bin/grep, and check with grep --version | head -1. If a grep pipeline unexpectedly prints nothing and exits 2, look at its stderr before tuning the pattern.