Yep, looks like it. >>> line = 'us::blah blah2 1002 blah3' >>> import re >>> TAG_pattern = re.compile(r"(us::.*) .*(1002|1003).*$") >>> if TAG_pattern.search(line): ... print 'we have a match' ... we have a match >>>
>>> line2 ='us::blah blah2 1001 blah3' >>> if TAG_pattern.search(line2): ... print 'we have a match' ... else: ... print 'no match found' ... no match found On 9/16/07, 王超 <[EMAIL PROTECTED]> wrote: > hi, > > I want to match the regular expression from right to left, such as: > > TAG_pattern = re.compile(r"(us::.*) .*(1002|1003).*$") > TAG_pattern.search(line) > > Does the search method support this? > > Thanks, > Daniel > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor