Re: regex with specific list of string

2007-09-26 Thread Steve Holden
james_027 wrote: > Hi all, > >> This is fine IMO since the OP didn't specify the opposite. >> > > Thanks for all your replies, though I don't understand quite well the > going argument? What do you mean when you say "the OP didn't specify > the opposite"? > > There reason for using regex is beca

Re: regex with specific list of string

2007-09-26 Thread james_027
Hi all, > This is fine IMO since the OP didn't specify the opposite. > Thanks for all your replies, though I don't understand quite well the going argument? What do you mean when you say "the OP didn't specify the opposite"? There reason for using regex is because I am going to use it in Django'

Re: regex with specific list of string

2007-09-26 Thread Steve Holden
Carsten Haese wrote: > On Wed, 2007-09-26 at 15:13 -0300, Pablo Ziliani wrote: >> Carsten Haese wrote: >>> Unfortunately, that also matches margarine, mayonnaise, and octopus, >>> just to name a few ;-) >> (and so does the solution you sent before :) > > No, it doesn't. > s = set(['jan', 'fe

Re: regex with specific list of string

2007-09-26 Thread Carsten Haese
On Wed, 2007-09-26 at 15:13 -0300, Pablo Ziliani wrote: > Carsten Haese wrote: > > Unfortunately, that also matches margarine, mayonnaise, and octopus, > > just to name a few ;-) > > (and so does the solution you sent before :) No, it doesn't. >>> s = set(['jan', 'feb', 'mar', 'apr', 'may', 'jun

Re: regex with specific list of string

2007-09-26 Thread Pablo Ziliani
Carsten Haese wrote: > On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote: >> james_027 wrote: >>> hi, >>> >>> how do I regex that could check on any of the value that match any one >>> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', >>> 'sep', 'oct', 'nov', 'dec' >>> >>> Th

Re: regex with specific list of string

2007-09-26 Thread Steve Holden
Carsten Haese wrote: > On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote: >> james_027 wrote: >>> hi, >>> >>> how do I regex that could check on any of the value that match any one >>> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', >>> 'sep', 'oct', 'nov', 'dec' >>> >>> Th

Re: regex with specific list of string

2007-09-26 Thread Carsten Haese
On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote: > james_027 wrote: > > hi, > > > > how do I regex that could check on any of the value that match any one > > of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', > > 'sep', 'oct', 'nov', 'dec' > > > > Thanks > > >>> patr =

Re: regex with specific list of string

2007-09-26 Thread Pablo Ziliani
Carsten Haese wrote: > On Wed, 2007-09-26 at 15:42 +, james_027 wrote: > >> hi, >> >> how do I regex that could check on any of the value that match any one >> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', >> 'sep', 'oct', 'nov', 'dec' >> > > Why regex? You can si

Re: regex with specific list of string

2007-09-26 Thread Steve Holden
james_027 wrote: > hi, > > how do I regex that could check on any of the value that match any one > of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', > 'sep', 'oct', 'nov', 'dec' > > Thanks >>> patr = re.compile('jan|feb|mar|apr|may|jun|jul|aug|sep|nov|oct|dec') >>> patr.mat

Re: regex with specific list of string

2007-09-26 Thread Carsten Haese
On Wed, 2007-09-26 at 15:42 +, james_027 wrote: > hi, > > how do I regex that could check on any of the value that match any one > of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', > 'sep', 'oct', 'nov', 'dec' Why regex? You can simply check if the given value is contained