On Sep 9, 9:23 am, [EMAIL PROTECTED] wrote: > >> I really dont care if theexpressionis optimal. So the goal is > >> something like: > > >> vowel_regexp = oneOf("a aa i ii u uu".split()) # yielding r'(aa|a|uu| > >> u|ii|i)' > > >> Is there a public module available for this purpose? > > Check Ka-Ping Yee's rxb module: > > http://lfw.org/python/
Ok <http://lfw.org/python/rxb.py> suffers from the possibility of putting shorter match before longer one: def either(*alternatives): options = [] for option in alternatives: options.append(makepat(option).regex) return Pattern('\(' + string.join(options, '|') + '\)') > Also, check PyPI to see if > someone has already updated rxb for use with re. No one has - http://pypi.python.org/pypi?%3Aaction=search&term=rxb&submit=search no results returned -- http://mail.python.org/mailman/listinfo/python-list