Wolfgang Rohdewald wrote: > I want to match a string only if a word (C1 in this example) appears > at most once in it.
def match(s): if s.count("C1") > 1: return None return s If this doesn't fit your requirements, you may want to provide some more details. Stefan -- http://mail.python.org/mailman/listinfo/python-list