import re
mylist = ["dog", "cat named bob", "wildcat", "thundercat", "cow also named bob", "hooo"]
r = re.compile('named')
# You might gfo through the list, check if there is match
# by running a re.search, and there is, extract it
newlist = [r.search(x).group() for x in mylist if r.search(x)]
print(newlist)
# Or, use map to get the matches first, and then
# check if the object is not None and then retrieve the value
newlist = [x.group() for x in map(r.search, mylist) if x]
print(newlist)
aW1wb3J0IHJlCm15bGlzdCA9IFsiZG9nIiwgImNhdCBuYW1lZCBib2IiLCAid2lsZGNhdCIsICJ0aHVuZGVyY2F0IiwgImNvdyBhbHNvIG5hbWVkIGJvYiIsICJob29vIl0KciA9IHJlLmNvbXBpbGUoJ25hbWVkJykKIyBZb3UgbWlnaHQgZ2ZvIHRocm91Z2ggdGhlIGxpc3QsIGNoZWNrIGlmIHRoZXJlIGlzIG1hdGNoIAojIGJ5IHJ1bm5pbmcgYSByZS5zZWFyY2gsIGFuZCB0aGVyZSBpcywgZXh0cmFjdCBpdApuZXdsaXN0ID0gW3Iuc2VhcmNoKHgpLmdyb3VwKCkgZm9yIHggaW4gbXlsaXN0IGlmIHIuc2VhcmNoKHgpXQpwcmludChuZXdsaXN0KQojIE9yLCB1c2UgbWFwIHRvIGdldCB0aGUgbWF0Y2hlcyBmaXJzdCwgYW5kIHRoZW4gCiMgY2hlY2sgaWYgdGhlIG9iamVjdCBpcyBub3QgTm9uZSBhbmQgdGhlbiByZXRyaWV2ZSB0aGUgdmFsdWUKbmV3bGlzdCA9IFt4Lmdyb3VwKCkgZm9yIHggaW4gbWFwKHIuc2VhcmNoLCBteWxpc3QpIGlmIHhdCnByaW50KG5ld2xpc3Qp