Regular expressions
Steven D'Aprano
steve at pearwood.info
Thu Nov 5 07:05:12 EST 2015
On Thu, 5 Nov 2015 07:33 pm, Peter Otten wrote:
> Steven D'Aprano wrote:
>
>> On Wed, 4 Nov 2015 07:57 pm, Peter Otten wrote:
>>
>>> I tried Tim's example
>>>
>>> $ seq 5 | grep '1*'
>>> 1
>>> 2
>>> 3
>>> 4
>>> 5
>>> $
>>
>> I don't understand this. What on earth is grep matching? How does "4"
>> match "1*"?
>
> Look for zero or more "1".
Doh!
Oh the shame, I knew that. Somehow I tangled myself in a knot, thinking that
it had to be 1 *followed by* zero or more characters. But of course it's
not a glob, it's a regex.
--
Steven
More information about the Python-list
mailing list