mstr = r"red hed ced ped" regex = r"[^c|p]ed" pattern = re.compile(regex) print pattern.findall(mstr)
red
hed
ced
ped