I am trying to determine if a python list item has a single character in it and if so replace it with an uncontracted version. The issue I am facing is that I cannot get it to detect a single letter (X) without it converting say boxer -> bocrossbreeder
list = ['canine', 'dog', 'X', 'boxer', 'XBreed', ' x ']
list_trimmed = [re.sub(r'\040x\040', 'CrossBreed', lst) for lst in list]
works okay for removing the ' x ' but if i try
list_trimmed = [re.sub(r'x', 'CrossBreed', lst) for lst in list]
it creates boCrossBreeder as it detects the x in a word in the list item.