You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
4.0 KiB

5 months ago
## NEWLINES MUST BE INDICATED BY \n
#########################################\n
#\n
# REG-EX \n
#\n
#########################################\n
\n
_year = '(?P<year>-?((20\d\d))|(\d\d)(?!:))'\n
_fullyear = '(?P<year>-?\d+\d\d(?!:))'\n
_year_epoch = '(?:' + _year + '(?P<epoch> *[ABCDE\.]+)?)'\n
_fullyear_epoch = '(?:' + _fullyear + '(?P<epoch> *[ABCDE\.]+)?)'\n
\n
_month = '(?P<month>[0-2]?\d(?!:))'\n
_fullmonth = '(?P<month>[01]\d(?!:))'\n
\n
_litmonth = ('(?P<litmonth>jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z,\.;]*')\n
\n
_day = '(?P<day>[0123]?\d(?!:))'\n
_usday = '(?P<day>[0123]?\d(?!:))(?:st|nd|rd|th|[,\.;])?'\n
_fullday = '(?P<day>[0123]\d(?!:))'\n
\n
############## RESTRICT DAY TO NOT BE YEAR\n
_day = '(?P<day>20(?![\d:])|(?!20)\d?\d(?!:))'\n
_usday = _day + '(?:st|nd|rd|th|[,\.;])?'\n
############## RESTRICT DAY TO NOT BE YEAR\n
\n
_litday = ('(?P<litday>mon|tue|wed|thu|fri|sat|sun)[a-z]*')\n
\n
_hour = '(?P<hour>[012]?\d)'\n
_minute = '(?P<minute>[0-6]\d)'\n
_second = '(?P<second>[0-6]\d(?:\.\d+)?)'\n
\n
_days = '(?P<days>\d*\d(?:\.\d+)?)'\n
_hours = '(?P<hours>\d*\d(?:\.\d+)?)'\n
_minutes = '(?P<minutes>\d*\d(?:\.\d+)?)'\n
_seconds = '(?P<seconds>\d*\d(?:\.\d+)?)'\n
\n
_sign = '(?:(?P<sign>[-+]) *)'\n
_week = 'W(?P<week>\d?\d)'\n
_zone = ('(?P<zone>[A-Z]+|[+-]\d\d?:?(?:\d\d)?)')\n
_ampm = '(?P<ampm>[ap][m.]+)'\n
\n
_time = '\D' +_hour + ':' + _minute + '(?::' + _second + ')? *' + _ampm + '? *' + _zone + '?' + '\D'\n
_isotime = '\D' + _hour + ':' + _minute + ':' + _second + '? *' + _zone + '?' + '\D'\n
_dottime = '\D' + _hour + '\.' + _minute + '\.' + _second + ' *' + _zone + '?' + '\D'\n
\n
_eurodate = _day + '\.' + _month + '\.' + _year_epoch + '?' \n
#_usdate = _month + '/' + _day + '(?:/' + _year_epoch + ')?' + '[^0-9\.]' # added + '[^0-9\.]' to prevent .6/5. in errors as being months\n
_usdate = _month + '/' + _day + '(?:/' + _year_epoch + ')?' + '[^0-9a-z\.]' # added + '[^0-9\.]' to prevent .6/5. in errors as being months\n
_altusdate = _month + '-' + _day + '-' + _fullyear_epoch \n
_isodate = _year + '-' + _fullmonth + '-?' + _fullday + '?(?!:)'\n
_altisodate = _year + _fullmonth + _fullday + '(?!:)'\n
_altlitdate = ('(?:'+ _litday + ',? )? *' + _litmonth + '[ ,.]+' + _usday + '(?:[ a-z]+' + _year_epoch + ')?')\n
_litdate = ('(?:'+ _litday + ',? )? *' + _usday + ' *' + '[- /] *(?:' + _litmonth + '|'+ _month +') *[- /] *' + _year_epoch + '?')\n
_eurlitdate = ('(?:'+ _litday + ',?[ a-z]+)? *' + '(?:'+ _usday + '[ a-z]+) *' + _litmonth + '(?:[ ,.a-z]+' + _year_epoch + ')?')\n
_dotdate = _year + '\.' + _month + '\.' + _day\n
\n
_restrictedDay = '(?:[^:0-9]|^)(?P<day>\d{1,2})(?:[^:0-9]|$)'\n
_restrictedFullday = '(?:[^:0-9]|^)(?P<day>\d{2})(?:[^:0-9]|$)'\n
_restrictedUsday = _restrictedDay + '(?:st|nd|rd|th|[,\.;])?'\n
_litdate = ('(?:'+ _litday + ',? )? *(?:[^.:0-9]|^)' + _usday + '(?:[^:0-9]|[ /-]) *(?:' + _litmonth + '|'+ _month +') *[- /] *' + _year_epoch )\n
_ascdate = ('(?:'+ _litday + ',? )? *' + _restrictedUsday + ' *' + '[- /] *(?:' + _litmonth + ') *[- /]' + '(?:[0-9: ]+)' + _year_epoch + '?')\n
_isodatelit = _year + '[/-]' + _litmonth + '[/-]' + _fullday + '(?!:)'\n
\n
########################################################\n
# #\n
# PUBLIC VARIABLES. THESE VARIABLES *MUST* BE DEFINED #\n
# #\n
########################################################\n
\n
## TO ADD MORE TIME/DATE FORMATS, CREATE REGEX AND ADD TO timePatterns and datePatterns LIST\n
## DATES AND TIME STRINGS ARE MATCHED AGAINST THE EXPRESSIONS IN THE ORDER THEY ARE DEFINED IN THE BELOW PATTERNS\n
timePatterns = [_time, _isotime, _dottime]\n
datePatterns = [_usdate, _altusdate, _litdate, _altlitdate, _isodate, _ascdate, _eurlitdate, _altisodate, _eurodate, _isodatelit, _dotdate]\n
\n
# SPEED OPTIMIZATION. ONLY PROCESS 1 OUT OF N LINES FOR TIMESTAMPING\n
processEveryNLines = 1\n
# DATES OUTSIDE THIS RANGE WILL BE ASSUMED TO BE A MISTAKE\n
minYear = 2000\n
maxYear = 2014\n
\n

Powered by BW's shoe-string budget.