Regular expressions

Michael Torrie torriem at gmail.com
Tue Nov 3 22:47:18 EST 2015


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. 
> 
> 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.  At least with GNU grep, that's the default.



More information about the Python-list mailing list