[Tutor] finding special character string

Alan Gauld alan.gauld at btinternet.com
Sun Jun 1 19:30:37 CEST 2008


"Kent Johnson" <kent37 at tds.net> wrote

> Assuming the strings are non-overlapping, i.e. the closing "." of 
> one
> string is not the opening "." of another, you can find them all with
>  import re
>  re.findall(r'\..*?\.', text)

Hmm, my regex hopelessness comes to the fore again.
Why a *?
I would probably have guessed the pattern to be

\..+?\.

What am I missing?

Alan G. 




More information about the Tutor mailing list