On 2015-11-04, Michael Torrie <torr...@gmail.com> wrote: > On 11/03/2015 08:23 PM, Steven D'Aprano wrote: >> >>>> Grep can use regular expressions (and I do so with it regularly), but >>>> it's default mode is certainly not regular expressions ... >>> >>> Its very name indicates that its default mode most certainly is >>> regular expressions. >> >> I don't even know what grep stands for.
General Regular Expression Parser (or somesuch) >> But I think what Michael may mean is that if you "grep foo", no regex >> magic takes place since "foo" contains no metacharacters. > > More likely I just don't know what I'm talking about. I must have > been thinking about something else (shell globbing perhaps). > > Certainly most of the times I've seen grep used, it's to look for a > word with no special metacharacters, as you say. Still a valid RE of > course. But I have learned to night I don't need to resort to grep -e > to use regular expressions. The -e turns on "enhanced" regexes which add a few more features to the regex language it parses. I've never been entirely sure if the -e regex language is backwards compatible with the default one or not... > At least with GNU grep, that's the default. Grep has always by default parsed its first command line argument (at least since v7 and Sys5). If you didn't want it treated as a regex, you had to specify -f. -- Grant Edwards grant.b.edwards Yow! I like your SNOOPY at POSTER!! gmail.com -- https://mail.python.org/mailman/listinfo/python-list