def AnyBut(s):
 ranges = chars_to_ranges(s)
 ranges.insert(0, (- maxint))
 ranges.append(maxint)
 result = CodeRanges(ranges)
 result.str = ('AnyBut(%s)' % repr(s))
 return result

def AnyBut ( s ) : ranges = chars_to_ranges ( s ) ranges . insert ( 0 , ( - maxint ) ) ranges . append ( maxint ) result = CodeRanges ( ranges ) result . str = ( 'AnyBut(%s)' % repr ( s ) ) return result
anybut(s) is an re which matches any character which is not in the string |s| .