13

The asterisk in regex

view full story
linux-howto

http://www.unix.com – I know through (my very limited) experience that you can't use the asterisk alone in a regex, but I still don't quite understand why. After all, it should match 'any or no characters'. To my mind, '*grep' should match: grep egrep fgrep While '.*grep' should match egrep fgrep ...but not 'grep' because it seems like we are insisting upon a character in front of 'grep' with that dot. Yet that is clearly not the case. Can someone explain why this is so? (Hope my use of 'grep' as the search term doesn't cause any confusion) (HowTos)