我想要这种日期格式的正则表达式 Wed Jul 16 00:00:00 UTC 2008 。
答案 0 :(得分:1)
(?<WeekDay>\w+)\s+(?<Month>\w+)\s+(?<MonthDay>\d+)\s+(?<Hour>\d+):(?<Min>\d+):(?<Sec>\d+)\s+(?<TimeZone>\w+)\s+(?<Year>\d+)
并获得此群组
${WeekDay}
${Month}
${MonthDay}
${Hour}
${Min}
${Sec}
${TimeZone}
${Year}
答案 1 :(得分:0)
使用此正则表达式
([a-zA-Z]{3}\s){2}\d{2}\s\d{2}:\d{2}:\d{2}\sUTC\s\d{4}
答案 2 :(得分:0)
$subject = "Wed Jul 16 00:00:00 UTC 2008 Tue Jul 12 15:00:04 UTC 2009";
$pattern = '![a-zA-Z]{3}\s+[a-zA-Z]{3}\s+\d{2}\s+\d{2}\:\d{2}\:\d{2}\s+[a-zA-Z]{3}\s+\d{4}!';
preg_match_all($pattern, $subject, $matches);
print_r($matches);
输出:
Array ( [0] => Array ( [0] => Wed Jul 16 00:00:00 UTC 2008 [1] => Tue Jul 12 15:00:04 UTC 2009 ) )
答案 3 :(得分:0)
EEE MMM dd HH:mm:ss z yyyy
如果您将Java
与SimpleDateFormat