简体   繁体   中英

Javascript UTC match RegExp

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM