王超 wrote:
> kent:
> Thank you.  I got the right results with re.findall('(us::.*?);', line).
> 
> I used these codes before:
>  >>> TAG_pattern = re.compile(r"(us::.*?)")
>  >>> TAG_pattern.findall(line)
> and got the unwanted results 'us::'

That is because .*? will match the empty string. You have to put the ;
after it to force the match to extend.

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to