keys = ['cat', 'dog', 'mouse']
text = 'Cat dog cat cloud miracle DOG MouSE'
converted = ' '.join('[%s](%s)' % (word, word.lower()) if word.lower() in
    keys else word for word in text.split())
converted
How to replace by regular expression to lowercase in python