[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17856: Unmatched right parenthesis in ERE

From: Nathan Weeks
Subject: bug#17856: Unmatched right parenthesis in ERE
Date: Thu, 26 Jun 2014 08:10:29 -0500

GNU grep 2.20 disallows the use of an unmatched right parenthesis in
an extended regular expression:

$ echo ')' | grep -E ')'
grep: Unmatched ) or \)

Other greps I've tried (AST grep 2014-01-06, BusyBox 1.22.1 grep, BSD
grep 2.5.1-FreeBSD on OS X 10.8, /usr/xpg4/bin/grep on Solaris
11.2-beta) accept ')' as a valid ERE.

POSIX apparently allows an unmatched right parenthesis in this
context, as section 9.4.3 (ERE Special Characters;

"The <right-parenthesis> shall be special when matched with a preceding
<left-parenthesis>, both outside a bracket expression."

and in section 9.5.1 (BRE/ERE Grammar Lexical Conventions)
the description of the "SPEC_CHAR" token contains the following

"The close-parenthesis shall be considered special in this context only if
matched with a preceding open-parenthesis."

Nathan Weeks
IT Specialist
USDA-ARS Corn Insects and Crop Genetics Research Unit
Crop Genome Informatics Laboratory
Iowa State University

reply via email to

[Prev in Thread] Current Thread [Next in Thread]