bug-gnu-utils
[Top][All Lists]
Advanced

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

repeated matches in grep


From: Peter Saffrey
Subject: repeated matches in grep
Date: Thu, 18 Oct 2001 12:54:48 +0100 (BST)

I have seemingly bug-like behaviour from gnu grep version 2.3 and 2.4 for 
linux.

I'm trying to find all the instances of a word that contains 6 of the same
letter by grepping through /usr/dict/words.

this works:

grep '\(.\).*\1.*\1.*\1.*\1.*\1' /usr/dict/words

but this does not:

grep '\(.\)\(.*\1\)\{5\}' /usr/dict/words

Shouldn't they be equivalent?

In perl, the regular expression (.)(.*\1){5} which seems to be equivalent
gives the correct results.

I guess this may not be a failure of grep, but rather the regular
expression library... In any case. 

Cheers,

Peter

-- 
University of Glasgow                   E-mail: address@hidden 
Department of Computing Science         Tel: +44 (0)141 339 8855 x0995
17, Lilybank Gardens                    Fax: +44 (0)141 330 4913 
Glasgow G12 8QQ                         http://www.dcs.gla.ac.uk/~pzs





reply via email to

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