How to match any string with file extension in a row and print only the corresponding word in python


I wanted to search and match any word followed by file extension .log.gz in a line and print only the matching word.

Below is the code example I tried,

# Global Import Variables
import Tkinter, Tkconstants, tkFileDialog

line = "helo how are helloo.log.gz you"

line_se ="\b.*\.log.gz", line)

if line_se:
    print line_se
    print("yo it's a {}".format(

But the output is the whole line until the extension like yo it's a helo how are helloo.log.gz, but the output I wanted is just helloo.log.gz. Can anyone correct me on the reg exp which I am using to print out the matching word with the extension !

Thanks a ton !

Change .* to \S* so it doesn't match spaces.

ine_se ="\S*\.log\.gz", line)