AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() ![]() ![]() ![]() Try it, it works very well and prevent your code from lot of bugs ! Likewise, What is this regex? This RegEx strictly controls the validity of the date and verify 28,30 and 31 days months, even leap years with 29/02 month. perhaps, you add ^ at the beginning and $ at the end of your answer to match the whole date string only. This will match date-like strings, which can then be validated using a proper date library if needed. Similarly, How to use regular expressions to validate a date string? that is the point - regular expressions should not be used for data validation. It does not identify some bad dates (for example, February 30th) but may be slightly better than using the simplistic \\d at each position. Here is a regex I wrote earlier today for validating strings in a format similar to what you mentioned: YYYY-MM-DD hh:mm:ss. How to use regular expressions to validate a date string?. ![]()
0 Comments
Read More
Leave a Reply. |