On 11/30/05, Ilan Volow <email@hidden> wrote:
> let $date := replace($date, ".*?,?\W*(\d+)\W*(\w+)\W*(\d+)\W*(\d{2}:\d
> {2}:\d{2})\W*(-|\+)(\d{1,2})(\d{2}$)", concat("$3-", $month, "-$1T$4
> $50$6:$7"))
FWIW, the feed validator also uses regular expressions to validate RFC
(2)822-style dates. Not sure why any client would want to be this
strict, but since Safari/WebCore is currently being too strict, the
following regular expression could be viewed as an improvement. It
also has the benefit of being well unit-tested.
>From http://cvs.sourceforge.net/viewcvs.py/feedvalidator/feedvalidator/src/feedvalidator/validators.py?view=markup
class rfc822(text):
rfc822_re = re.compile("(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), *)?" +
"\d\d? +((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|" +
"(Nov)|(Dec)) +\d\d(\d\d)? +\d\d:\d\d(:\d\d)? +(([+-]?\d\d\d\d)|" +
"(UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|\w)$")
def validate(self):
if not self.rfc822_re.match(self.value):
self.log(InvalidRFC2822Date({"parent":self.parent.name,
"element":self.name, "value":self.value}))
else:
self.log(ValidRFC2822Date({"parent":self.parent.name,
"element":self.name, "value":self.value}))
--
Cheers,
-Mark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
syndication-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/syndication-dev/email@hidden
This email sent to email@hidden