Overlapping Regular Expression Matches With findall()

Mystilleef mystilleef at gmail.com
Thu Dec 15 15:26:07 EST 2005


Hello,

Thanks for your response. I was going by the definition in
the manual. I believe a search only returns the first
match of a regular expression pattern in a string and then
stops further searches if one is found. That's not what I
want.

I want a pattern that scans the entire string but avoids
returning duplicate matches. For example "cat", "cate",
"cater" may all well be valid matches, but I don't want
duplicate matches of any of them. I know I can filter the
list containing found matches myself, but that is somewhat
expensive for a list containing thousands of matches.

Thanks




More information about the Python-list mailing list