The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have been using the following regular expression, ^(0\d{1}|1[0-2])\/([0-2]\d{1}|3[0-1])\/(19|20)\d{2} ?((0[0-9]|1[0-2]):[0-5][0-9] ([A]|[P])[M])?$ to validate a date with an optional time component. It verifies correctly test stings such as 12/02/2022 and 12/02/2022 00:00 AM in regex101, but when used in the regex validation rule, it always returns false.
PKPriyanka Karthikeyan Syncfusion Team January 14, 2025 11:59 AM UTC
Hi George,
Thank you for reaching out to us! We truly appreciate your inquiry. To assist you with your requirement, you can use the following regular expression. This will help ensure that the date is validated in the desired MM/DD/YYYY format, with an optional time component in HH:MM AM/PM format. Below is the code snippet that incorporates this regular expression along with the appropriate validation rules.