Reputation: 2929
I'm trying to test if passed string is matching the following format (Thu, 08 Dec 2011 18:48:38 GMT), but I really suck in regular expressions. Any suggestions? Thanks.
Upvotes: 2
Views: 1009
Reputation: 6030
Here's the regular expression to test what you want:
var t = newDate();
/(Mon|Tue|...|Sun)\,\s\d{2}\s(Jan|Feb|...|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT/.test(t.toUTCString())
of course you have to replace the ... with the remaining day and month names
Upvotes: 2