On 5/22/22 15:22, Paul Eggert wrote: > We've already uncovered one area, where \a doesn't work as expected and > where a warning diagnostic would be helpful. I installed the attached patch to cause 'grep' to warn about these. Comments welcome. Most of the changes were in Gnulib's dfa module, which see. > Here's another one, where an oddly-placed '*' doesn't work as one would expect: > > $ printf '*\na\n*a\n' | grep '\(*\)' > * > *a > $ printf '*\na\n*a\n' | grep -E '(*)' > grep: Unmatched ( or \( > $ printf '*\na\n*a\n' | grep '\(*a\)' > *a > $ printf '*\na\n*a\n' | grep -E '(*a)' > a > *a I plan to look at this next. We shouldn't warn about BREs like '\(*\)' and '\(*a\)' as these conform to POSIX and work fine. But it makes sense to warn about EREs like '(*)', '(*a)', '(+)', '(+a)', '({1})', '({1}a)' as POSIX does not specify their behavior, their semantics are unpredictable with GNU grep, and it's plausible that people are making mistakes in this area.