yes, but I mean if I have the line like this:

line = """38166 us::Video_Cat::Other; us::Video_Cat::Today Show;
us::VC_Supplier::bc; 1002::ms://bc.wd.net/a275/video/tdy_is.asf;
1003::ms://bc.wd.net/a275/video/tdy_is_.fl;"""

I want to get the part "us::MSNVideo_Cat::Other; us::MSNVideo_Cat::Today
Show; us::VC_Supplier::Msnbc;"

but re.compile(r"(us::.*) .*(1002|1003).*$") will get the
"1002::ms://bc.wd.net/a275/video/tdy_is.asf;" included in an lazy mode.

How can i filter it out in the re?

Thanks,
Daniel


On 9/16/07, Tom Tucker <[EMAIL PROTECTED]> wrote:
>
> 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

Reply via email to