diff --git a/cron_validator/util.py b/cron_validator/util.py index 559a88b..55ff15c 100644 --- a/cron_validator/util.py +++ b/cron_validator/util.py @@ -1,4 +1,5 @@ import datetime +import re import dateutil.parser import pytz @@ -29,3 +30,27 @@ def str_to_datetime(datetime_str, tz_name="UTC"): :return: """ return dateutil.parser.parse(datetime_str).replace(tzinfo=get_tz(tz_name)) + + +def replace_names(expression): + """ + + :param expression: + :return: + """ + parts = expression.split(" ") + month_names = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"] + day_of_week_names = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"] + month_names_re = re.compile(rf"(?