I want to check if a string contains digits in the format dddd-dd-dd. I'm not interested in checking valid dates.
Examples:
Input:
att_token_2015-09-02Expected output: True
Input:
att_token_1234-99-99Expected output: True
Input:
att_token_1234Expected output: False
EDIT: I haven't tried this in any program. I just want the regex pattern for it.
(\d+)-(\d+)-(\d+)
This is what I have tried so far and it returns me the numbers but I do not know if this is right.
date_parseif the return value is not FALSE, and you are done (this is for PHP, you need to use one for your programming language). And the reason for downvotes is simple: validating datetime values is veeery frequent issue on SO, you should really search a bit, and you will find tons of solutions.