minimalist regular expression

Trent Mick trentm at
Thu Aug 25 23:04:52 CEST 2005

[borges2003xx at wrote]
> Exists some tool, programs or some able to compute the minimal regular
> expression, namely ,taking a series of regular exoression, the minimal
> one that makes the same matching?

    def get_minimal_regex(*regexes):
        return ".*"

:)  Or, slightly less smart-ass-y:

    def get_not_really_minimal_regex(*regexes):
        return "(" + "|".join(regexes) + ")"


Trent Mick
TrentM at

More information about the Python-list mailing list