Need a regex with the following format: YYYY MMM DD HH:MM:SS
For example: 1995 FEB 10 12:12:20
Please advise.
Thanks!
Need a regex with the following format: YYYY MMM DD HH:MM:SS
For example: 1995 FEB 10 12:12:20
Please advise.
Thanks!
This regex will catch that format:
\d{4} \w{3} \d{2} \d{2}:\d{2}:\d{2}
\d
looks for digits.
\w
looks for characters.
{#}
looks for a specific number of occurrences of the previous character.
However, this will not validate the months, or the range of digits. This might be the closest that you can get, by using number ranges:
\d{4} (?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) [1-3][0-9] [0-1][0-9]:[0-5][0-9]:[0-5][0-9]
Keep in mind that this can find dates like Feb 35. If you need to validate an address, you cannot (easily) do that with regex; you're much better off using functionality built into a programming language/library.