Re: [Tutor] advice on regex matching for dates?

2008-12-12 Thread Lie Ryan
On Thu, 11 Dec 2008 23:38:52 +0100, spir wrote: Serdar Tumgoren a écrit : Hey everyone, I was wondering if there is a way to use the datetime module to check for variations on a month name when performing a regex match? In the script below, I created a regex pattern that checks for dates

Re: [Tutor] advice on regex matching for dates?

2008-12-11 Thread Kent Johnson
On Thu, Dec 11, 2008 at 2:31 PM, Serdar Tumgoren zstumgo...@gmail.com wrote: Hey everyone, I was wondering if there is a way to use the datetime module to check for variations on a month name when performing a regex match? Parsing arbitrary dates is hard, in fact the most general case is not

Re: [Tutor] advice on regex matching for dates?

2008-12-11 Thread spir
Serdar Tumgoren a écrit : Hey everyone, I was wondering if there is a way to use the datetime module to check for variations on a month name when performing a regex match? In the script below, I created a regex pattern that checks for dates in the following pattern: August 31, 2007. If

Re: [Tutor] advice on regex matching for dates?

2008-12-11 Thread John Fouhy
On 12/12/2008, spir denis.s...@free.fr wrote: I just found a simple, but nice, trick to make regexes less unlegible. Using substrings to represent sub-patterns. E.g. instead of: [...] Another option is to use the re.VERBOSE flag. This allows you to put comments in your regular expression and

Re: [Tutor] advice on regex matching for dates?

2008-12-11 Thread Serdar Tumgoren
Thanks to all for the replies! The FeedParser example is mind-bending (at least for this noob), but of course looks very powerful. And thanks for the tips on cleaning up the appearance of the code with sup-patterns. Those regex's can get hairy pretty fast.