You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Blue Prism工具中Excel来源日期(dd/mm/yyyy格式)验证问题求助

Fixing Date Validation for Excel-Sourced Dates in Blue Prism

Got it, let's work through this date validation issue you're hitting with Excel dates in Blue Prism. The problem with your original regex is that it forces two digits for day and month, but Excel often spits out single-digit days/months without leading zeros. Here's how to fix this:

Updated Regex Pattern

Use this regex to match dates with 1 or 2 digits for day/month and a 4-digit year:

^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/[0-9]{4}$

Let me break down the key parts:

  • 0?[1-9]: Matches single-digit days/months (1-9) with or without a leading zero (e.g., 5 or 05)
  • [12][0-9]: Covers days 10-29
  • 3[01]: Handles valid end-of-month days (30 or 31)
  • 0?[1-9]|1[012]: Ensures months are 1-9 (with/without zero) or 10/11/12
  • [0-9]{4}: Guarantees a 4-digit year (no 2-digit shortcuts like 24)

Implementing This in Blue Prism

  1. Add a Regex Match action to your Blue Prism process.
  2. Paste the regex pattern above into the "Pattern" field.
  3. Feed your Excel-sourced date string into the "Input String" field.
  4. Check the "Match Result" output—if it returns True, the date format fits your dd/mm/yyyy requirement (with or without leading zeros for single-digit values).

Bonus: Strict Date Validation (Beyond Regex)

Regex checks format, but it can’t catch invalid dates like 31/04/2024 (April only has 30 days) or 29/02/2023 (not a leap year). For full robustness, combine regex with Blue Prism’s date conversion function:

  • After passing the regex check, use the ToDate() function:
    ToDate([Your Date String], "dd/MM/yyyy")
    
  • If this function returns a valid date value, the date is both formatted correctly and logically valid. If it throws an error, mark the date as invalid.

This approach handles all the edge cases from Excel’s date formatting while keeping your validation solid in Blue Prism.

内容的提问来源于stack exchange,提问作者Ankhush singh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:40:09