regex (?!..) problem

Stefan Behnel stefan_ml at behnel.de
Mon Oct 5 08:30:20 CEST 2009


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



More information about the Python-list mailing list