Often, I would like to build up complex regexps from simpler ones. The only way I'm currently aware of of doing this is through string operations, e.g.:
Year = r'[12]\d{3}'
Month = r'Jan|Feb|Mar'
Day = r'\d{2}'
HourMins = r'\d{2}:\d{2}'
Date = r'%s %s, %s, %s' % (Month, Day, Year, HourMins)
DateR = re.compile(Date)
Is anybody aware of a different method or a more systematic approach (maybe a module) in Python to have composable regexps? I'd rather compile each regexp individually (e.g. for using individual compile options), but then there doesn't seem to be a way of composing them anymore!?