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.)