text = "Some text here 09:00 - Movies 10:00 - Cartoons 11:00 SPorts .... 20:00 - News Another text here"

I am trying to get only the parts with the time in front.Here is my code:

match = findall('\d\d:\d\d\s-\s\D+', text)

My problem is that at the end i said to read until finding a digit,and when it reaches the last time 20:00 - News it prints "Another text here" too.How can i modify ti print only "09:00 - Movies 10:00 - Cartoons 11:00 SPorts .... 20:00 - News ".

Thanks.

I think easiest would be to just post process apropriately the last match from list of matches. You could also prove \w+ instead of \D+.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.