Hi, thanks for the reply. I'd like to respond to each section: "To me, this behavior is logical, because it assumes that the lack of a matching brace indicates that the author of the expression simply wasn't intending to use the repetition syntax at all."
The problem with this assumption is that it means all mismatches are intentional and there are no mismatch errors. Ever. If the author of the expression was intending a literal match, then the opening curly brace should have been escaped. This is how intentional literals can be properly exprressed, while also catching all unintentional mismatches. "That would follow an intuition like "metacharacters are only metacharacters if they're used within a correct context". This intuition enforces my previous point because it means it will catch no balance errors. Everything is assumed intentional, leading to strange results. "But it's inconsistent with the treatment of [], where the opening bracket is always a metacharacter regardless of whether it's used to introduce a valid character-class expression." And the lack of consistency was going to be my next point, albeit cross-platform. A regex should behave the same cross-platform. The Mac's grep is derived from AT&T Unix (the mother of all greps?) and it seems to me that GNU should at least be compatible with pre-existing behavior, other design philosophies aside. ________________________________ From: Seth David Schoen <[email protected]> Sent: Wednesday, October 1, 2025 3:16 PM To: Bob Peraino <[email protected]> Cc: [email protected] <[email protected]> Subject: Re: bug#79550: Grammar bug in grep External Message: Use Caution To me, this behavior is logical, because it assumes that the lack of a matching brace indicates that the author of the expression simply wasn't intending to use the repetition syntax at all. That would follow an intuition like "metacharacters are only metacharacters if they're used within a correct context". But it's inconsistent with the treatment of [], where the opening bracket is always a metacharacter regardless of whether it's used to introduce a valid character-class expression. $ echo 'hello{' | egrep '{' hello{ $ echo 'hello[' | egrep '[' grep: Invalid regular expression
