Message340102
| Author |
mrabarnett |
| Recipients |
Anders.Hovmöller, ezio.melotti, mrabarnett, serhiy.storchaka |
| Date |
2019年04月12日.19:53:42 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1555098822.5.0.173925374861.issue32308@roundup.psfhosted.org> |
| In-reply-to |
| Content |
Consider re.findall(r'.{0,2}', 'abcde').
It finds 'ab', then continues where it left off to find 'cd', then 'e'.
It can also find ''; re.match(r'.*', '') does match, after all.
It could, in fact, an infinite number of ''.
And what about re.match(r'()*', '')?
What should it do? Run forever? Raise an exception?
At some point you have to make a decision as to what should happen, and the general consensus has been to match once. |
|