import re
string = "Foo \n value of something \n Bar \n Another value \n"
changewords = ["foo", "Bar"]
tem = string
for i in changewords:
tem = re.sub(f'(?i){i} \n', f'{i}:', tem)
print( tem )
aW1wb3J0IHJlCgpzdHJpbmcgPSAiRm9vIFxuIHZhbHVlIG9mIHNvbWV0aGluZyBcbiBCYXIgXG4gQW5vdGhlciB2YWx1ZSBcbiIKY2hhbmdld29yZHMgPSBbImZvbyIsICJCYXIiXQoKdGVtID0gc3RyaW5nCmZvciBpIGluIGNoYW5nZXdvcmRzOgogICAgdGVtID0gcmUuc3ViKGYnKD9pKXtpfSBcbicsIGYne2l9OicsIHRlbSkKcHJpbnQoIHRlbSApCg==