=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/grep/util.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- src/usr.bin/grep/util.c 2004/10/03 19:23:02 1.29 +++ src/usr.bin/grep/util.c 2005/04/03 19:12:40 1.30 @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.29 2004/10/03 19:23:02 otto Exp $ */ +/* $OpenBSD: util.c,v 1.30 2005/04/03 19:12:40 otto Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -302,7 +302,12 @@ } /* Remove enclosing [[:<:]] and [[:>:]] (word match). */ - if (fg->patternLen >= 14 && + if (wflag) { + /* basic re's use \( \), extended re's ( ) */ + int extra = Eflag ? 1 : 2; + fg->patternLen -= 14 + 2 * extra; + fg->wmatch = 7 + extra; + } else if (fg->patternLen >= 14 && strncmp(pattern + fg->bol, "[[:<:]]", 7) == 0 && strncmp(pattern + fg->bol + fg->patternLen - 7, "[[:>:]]", 7) == 0) { fg->patternLen -= 14;