Junio C Hamano <gitster@xxxxxxxxx> writes: > "Ping Yin" <pkufranky@xxxxxxxxx> writes: > ... >> man grep says >> In basic regular expressions the metacharacters ?, +, {, |, (, and ) >> lose their special meaning; instead use the backslashed versions \?, >> \+, \{, \|, \(, and \). >> >> Doen't it mean that '\|' is BRE ? > > It just says unlike in ERE, these characters are not special in BRE; it > does not at all say using backslash like \?, \+, and \| makes them so. > > And they are not. \(...\), \{m\}, \{m,\} and \{m,n\} are part of BRE, but > the two you used (\+ and \|) are not. GNU accept these two as extensions, > but other POSIX implementations may have troubles with them. > > http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html > > Please be gentle to porters to non GNU systems. Either stay inside BRE > (which I think we have managed to do with our usage of grep) or explicitly > ask for ERE with "grep -E". I think this would help people new to our codebase. Also Message-ID: <7v4pdtgjf0.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx> Subject: Re: [PATCH] git-filter-branch could be confused by similar names Date: Fri, 04 Jan 2008 17:17:39 -0800 aka http://article.gmane.org gmane.comp.version-control.git/69630 --- Documentation/CodingGuidelines | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 3b042db..994eb91 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -53,6 +53,18 @@ For shell scripts specifically (not exhaustive): - We do not write the noiseword "function" in front of shell functions. + - As to use of grep, stick to a subset of BRE (namely, no \{m,n\}, + [::], [==], nor [..]) for portability. + + - We do not use \{m,n\}; + + - We do not use -E; + + - We do not use ? nor + (which are \{0,1\} and \{1,\} + respectively in BRE) but that goes without saying as these + are ERE elements not BRE (note that \? and \+ are not even part + of BRE -- making them accessible from BRE is a GNU extension). + For C programs: - We use tabs to indent, and interpret tabs as taking up to -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html