Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!PRC.UNISYS.COM!lang From: lang@PRC.UNISYS.COM Newsgroups: gnu.utils.bug Subject: Grep bug? Message-ID: <8909121817.AA11159@gem> Date: 12 Sep 89 18:17:21 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 27 This may not be a bug, but rather my misunderstanding the documentation, but this strikes me as odd.... % grep '\wx\w' foo finds all occurrences in foo of 'x' flanked by alphanumerics. % grep '\Wx\W' foo finds all occurrences in foo of 'x' flanked by non-alphanumerics. Fine. So far so good. Suppose now I want to find all occurrences of 'x' flanked by non-alphanumerics, but I want the match on 'x' not to be case-sensitive. Well, the -i flag makes grep ignore case difference when comparing strings, so I try % grep -i '\Wx\W' foo But the effect here is that the -i flag makes the '\W' meta-character non-case-sensitive as well, and I get all occurrences of x in foo, regardless of the case of x (which is fine) but also regardless of whether or not the x (or X) is flanked by non-alphanumerics! Is this a feature? --Francois Lang