regex with specific list of string
Carsten Haese
carsten at uniqsys.com
Wed Sep 26 14:35:06 EDT 2007
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', 'jul', 'aug',
... 'sep', 'oct', 'nov', 'dec'])
>>> 'margarine' in s
False
>>> 'mayonnaise' in s
False
>>> 'octopus' in s
False
> This is fine IMO since the OP didn't specify the opposite.
True, but my crystal ball tells me that the OP wants exact matches.
(Extrapolating from another post made by the OP earlier today, I'm
guessing he has a list of column names to include in an SQL "order by"
clause, and he wants to check them for validity first.)
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the Python-list
mailing list