ignore case only for a part of the regex?

Helmut Jarausch jarausch at skynet.be
Sun Dec 30 12:24:54 CET 2012


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


the regex should match  Msg-id:, Msg-Id, ...  but not  msg-id: and so on.

I've tried the pattern
but (?i) makes the whole pattern ignoring case.

In my simple case I could say
but that's a bit clumsy.

Is there a more elegant way? Is there a way to compose a pattern
from subpatterns which are compiled with different flags?

Many thanks for a hint,

More information about the Python-list mailing list