All the examples I found are checking if the string follows a certain pattern and is digit, for example "\d{4}-\d{2}-\d{2}". I want to check if the date is later than a given date, for example, to check if the date follows pattern “yyyy-mm-dd” and is later than “2009-03-01”. How to achieve that?
All the examples I found are checking if the string follows a certain pattern
Share
Don’t use a regex for this. It’s like trying to use a saw to hammer in a nail.
Use whatever date parsing your language provides you and use that to perform the check.
If you need to extract the date from a string in order to do this, by all means, use a regex, but only for that part.