bug-grep
[Top][All Lists]
Advanced

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

Incorrect regex format in man grep


From: Davide Brini
Subject: Incorrect regex format in man grep
Date: Tue, 4 Jan 2011 15:39:17 +0000
User-agent: KMail/1.13.5 (Linux/2.6.36-gentoo-r5; KDE/4.4.5; x86_64; ; )

The grep 2.7 man page has, in the section "REGULAR EXPRESSIONS":

  Repetition
       A regular expression may be followed by one of several repetition 
operators:
...
       {,m}   The preceding item is matched at most m times.

As far as I know, that format is not standard, and in any case, it seems that 
grep rejects it, or it doesn't work as expected:

$ echo 'abbbbc' | grep 'b\{,4\}'
src/grep: malformed repeat count

$ echo 'abbbbc' | grep -E 'b{,4}'
$

$ echo 'abbbbc' | grep -E 'b{,1}'
$

$ grep --version
grep (GNU grep) 2.7
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see 
<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.

-- 
D.



reply via email to

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