def get_date_regex(timestring):
 prev = ''
 curr = ''
 regex = ''
 for s in range(0, len(timestring)):
  curr = timestring[s]
  if (curr == '%'):
   pass
  elif ((curr in settings.date_regex()) and (prev == '%')):
   regex += (('\\d{' + settings.date_regex()[curr]) + '}')
  elif (curr in ['.', '-']):
   regex += ('\\' + curr)
  else:
   regex += curr
  prev = curr
 logger.debug('regex = {0}'.format(regex))
 return regex

def get_date_regex ( timestring ) : prev = '' curr = '' regex = '' for s in range ( 0 , len ( timestring ) ) : curr = timestring [ s ] if ( curr == '%' ) : pass elif ( ( curr in settings . date_regex ( ) ) and ( prev == '%' ) ) : regex += ( ( '\\d{' + settings . date_regex ( ) [ curr ] ) + '}' ) elif ( curr in [ '.' , '-' ] ) : regex += ( '\\' + curr ) else : regex += curr prev = curr logger . debug ( 'regex = {0}' . format ( regex ) ) return regex
return a regex string based on a provided strftime timestring .