正则表达式,获取电子邮件日期头字段的所有部分
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了正则表达式,获取电子邮件日期头字段的所有部分相关的知识,希望对你有一定的参考价值。
This snippet is useful if you want to extract the relevant parts out of an Date header field of an email message. It was created according to the [RFC 5322 rules](http://tools.ietf.org/html/rfc5322#page-15 "RFC 5322, Page 15"). It supports named capturing groups for easier access of the date parts.tested in php 5.2.6
2do:
* deal with obs-% data
'~(s?(?P<weekday>Mon|Tue|Wed|Thu|Fri|Sat|Sun))[,]?s?(?P<day>[0-9]{1,2})s(?P<month>Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)s(?P<year>[0-9]{4})s(?P<hours>[0-9]{2}):(?P<minutes>[0-9]{2})(:(?P<seconds>[0-9]{2}))?s(?P<timezone>[+|-][0-9]{4})s?~'
以上是关于正则表达式,获取电子邮件日期头字段的所有部分的主要内容,如果未能解决你的问题,请参考以下文章