Cpcp Cp writes:
> Look this
>
> >>> import re
> >>> text="asdfnbd]"
> >>> m=re.sub("n*?","?",text)
> >>> print m
> ?a?s?d?f?n?b?d?]?
>
> I don't understand the 'non-greedy' pattern.
Since ān*ā matches zero or more ānās, it matches zero adjacent to every
actual character.
It's non-greedy because
Look this
>>> import re
>>> text="asdfnbd]"
>>> m=re.sub("n*?","?",text)
>>> print m
?a?s?d?f?n?b?d?]?
I don't understand the 'non-greedy' pattern.
I think the repl argument should replaces every char in text and outputs
"".
--
https://mail.python.org/mailman/listinfo/python-list