$ echo 'HI' | grep '\w*'
HI
$ echo 'HI' | grep '\w+'
$ echo 'HI' | grep '\w{2}'
For cases 2 & 3, grep must have returned 'HI', but is returning nothing. Is there something wrong in what I am grepping for?
Regular expressions in their pure form is precisely what Global Regular Expression Print supports. The \w escape was introduced in Perl regular expressions in the late 1980s, almost 20 years after grep was created. The GNU grep suite alludes to a command pgrep in its documentation, but you are probably better off learning the differences, and learning to use traditional regexes with grep.
\wmatches a literal w, and+matches a literal plus sign. (In this case, it's redundant anyway, because grep prints the entire input line if there is a match). You are looking forecho hi | grep -i '[a-z]'or if you really insist on using Perl's regex syntaxecho hi | perl -ne 'print if /\w/'grepsupports options-G(BRE: basic regular expressions),-E(ERE: extended regular expressions),-F(fixed strings, but optionally many of them), and-P(Perl regular expressions - though it doesn't say precisely which version of Perl). If you have GNUgrepand want Perl-style regular expressions, usegrep -P '^\w{2}$'or whatever.