Can someone explain the below behavior please? >>> re1 = re.compile(r'(?:((?:1000|1010|1020))[ ]*?[\,]?[ ]*?){1,3}') >>> re.findall(re_obj,'1000,1020,1000') ['1000'] >>> re.findall(re_obj,'1000,1020, 1000') ['1020', '1000']
However when I use "[\,]??" instead of "[\,]?" as below, I see a different result >>> re2 = re.compile(r'(?:((?:1000|1010|1020))[ ]*?[\,]??[ ]*?){1,3}') >>> re.findall(re_obj,'1000,1020,1000') ['1000', '1020', '1000'] I am not able to understand what's causing the difference of behavior here, I am assuming it's not 'greediness' if "?" Thank you, Kishor -- http://mail.python.org/mailman/listinfo/python-list