Bug : BUG036: strip_non_alphanumeric should remove all non-alphanumeric characters, not just leading and trailing ones. use re.sub(r'\W+', '', s)