bug-grep
[Top][All Lists]
Advanced

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

\w != [[:alnum:]]


From: Per Starbäck
Subject: \w != [[:alnum:]]
Date: Fri, 16 Nov 2007 15:09:03 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi!

grep-2.5.3

$ echo foo_bar | grep -o '\w*'
foo_bar
$ echo foo_bar | grep -o '[[:alnum:]]*'
foo
bar

But the documentation says

==== grep.texi ====
@item @samp{\w}
Match word constituent, it is a synonym for @samp{[[:alnum:]]}.
===================

==== grep.1 =======
.B \eW
is a synonym for
.BR [^[:alnum:]] .
===================

I don't know if the bug is in the program or the documentation.

(I think \w originally was added in Perl, and there it is defined as
'alphanumeric plus "_"'. On the other hand that definition of word
character is also used for \b in Perl which it isn't by GNU grep.)




reply via email to

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