minimalist regular expression

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


[borges2003xx at yahoo.it 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

-- 
Trent Mick
TrentM at ActiveState.com



More information about the Python-list mailing list