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

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

grep option "-i" does not work for me with backreference


From: Clifford Ekholm OOK
Subject: grep option "-i" does not work for me with backreference
Date: Sun, 29 Oct 2000 01:18:11 +0300 (EEST)

Hi

"grep --version" gave
grep (GNU grep) 2.4.2

Trying to learn a bit about regular expressions and tried the following to
find doubled words in a textfile that looked like this:

  Line 0: ...... Hello there.
  Line 1: ... hupa hupa ...
  Line 2: ... Hupa Hupa ...
  Line 3: ... Hupa hupa ... 
  Line 4: a b cd efg

With "egrep -i '\<([a-z]+) +\1\>'"      I only cought line 1
with "egrep -i '(\<[a-zA-Z]+) +\1\>'"   I caught line 1 and 2

with "egrep -i huPa" I caught all 3 lines which shows the option "-i" does
something; "egrep huPa" did not catch any line.

I would have thought I could have caught " Hupa hupa " even with the first
try.

Best regards

Clifford


/**********************  address@hidden  **************************************
Clifford Ekholm                <- WWW:   http://noon.abo.fi/~cliffa/
Abo Akademi University         <- WWW:   http://www.abo.fi/
Dept. of Chemical Engineering   * 
Laboratory for Inorganic Chem. <- WWW:   http://noon.abo.fi/fak/ktf/ook/
Biskopsgatan 8                  * Voice: (+358)-2-2154822 Noon - Post Midnight
FIN-20 500 Abo                  * Fax:           -2154962
FINLAND                         * 
******************************************************************************/

#!/usr/bin/perl
print +(split(//,'Just another Polack,'))[0..13,10..11,15,4,9,16..18,10,11,19];




reply via email to

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