Thanks for all those suggestions. They are good! 1) Let's suppose now that instead of just affecting "thing = m.group(1)", I need to do a piece of logic depending on which match I entered...
2) Concerning the suggestion : m = re.match(r'define\s+(\S+)\s*{$', line) if m: thing = m.group(1) m = re.match(r'include\s+(\S+)$', line) if m: thing = m.group(1) #etc... It means that I'll do all the checks, even if the first one did match and I know that the next will not... Thanks again. -- http://mail.python.org/mailman/listinfo/python-list