> You'll want to use a non-greedy match: > x = re.compile(r"START(.*?)END", re.DOTALL) > Otherwise the . will match END as well.
On Sep 21, 3:23 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Only if there's a later END in the string, in which case the user's > requirements will determine whether greedy matching is appropriate. > > regards > Steve There will be lots of START END combinations in the data. This is more accurate: sfgdfg*START*dfhdgh*END*dfdgh*START*dfhfdgh*END*dfgsdh*START*sdfhfdhj*END*fdghfdj The RE should extract the data between each couples of START and END. Thanks! -- http://mail.python.org/mailman/listinfo/python-list