ignore case only for a part of the regex?

Roy Smith roy at panix.com
Sun Dec 30 16:20:19 CET 2012


Helmut Jarausch <jarausch at skynet.be> wrote:

> is there a means to specify that 'ignore-case' should only apply to a part
> of a regex?

Not that I'm aware of.
 
> the regex should match  Msg-id:, Msg-Id, ...  but not  msg-id: and so on.

What's the use-case for this?

The way I would typically do something like this is build my regexes in 
all lower case and .lower() the text I was matching against them.  I'm 
curious what you're doing where you want to enforce case sensitivity in 
one part of a header, but not in another.



More information about the Python-list mailing list