diff --git a/dags/veda_data_pipeline/utils/build_stac/utils/regex.py b/dags/veda_data_pipeline/utils/build_stac/utils/regex.py index 471832ee..6493e73d 100644 --- a/dags/veda_data_pipeline/utils/build_stac/utils/regex.py +++ b/dags/veda_data_pipeline/utils/build_stac/utils/regex.py @@ -41,13 +41,13 @@ def extract_dates( Extracts start & end or single date string from filename. """ DATE_REGEX_STRATEGIES = [ - (r"_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})", "%Y-%m-%dT%H:%M:%S"), - (r"_(\d{8}T\d{6})", "%Y%m%dT%H%M%S"), - (r"_(\d{4}_\d{2}_\d{2})", "%Y_%m_%d"), - (r"_(\d{4}-\d{2}-\d{2})", "%Y-%m-%d"), - (r"_(\d{8})", "%Y%m%d"), - (r"_(\d{6})", "%Y%m"), - (r"_(\d{4})", "%Y"), + (r"[_\.\-](\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})", "%Y-%m-%dT%H:%M:%S"), + (r"[_\.\-](\d{8}T\d{6})", "%Y%m%dT%H%M%S"), + (r"[_\.\-](\d{4}_\d{2}_\d{2})", "%Y_%m_%d"), + (r"[_\.\-](\d{4}-\d{2}-\d{2})", "%Y-%m-%d"), + (r"[_\.\-](\d{8})", "%Y%m%d"), + (r"[_\.\-](\d{6})", "%Y%m"), + (r"[_\.\-](\d{4})", "%Y"), ] # Find dates in filename