<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 30, 2012 at 10:20 AM, Roy Smith <span dir="ltr"><<a href="mailto:roy@panix.com" target="_blank">roy@panix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Helmut Jarausch <<a href="mailto:jarausch@skynet.be">jarausch@skynet.be</a>> wrote:<br>
<br>
> is there a means to specify that 'ignore-case' should only apply to a part<br>
> of a regex?<br></div></blockquote><div><br></div><div>Python has excellent string methods.  There seems to be a split between people who first always grab regex for string parsing, and those who  might not.  If you go with your regex, I think you can comment what you have and move on.  I glaze over looking at regexes.  That's just me. The code to first search for "Msg-", then check what follows would take a couple of lines, but might be easier to understand later.  I've been writing python for a couple of years, and although I feel comfortable with it, there is much more more me to learn.  One thing I have learned over many years of programming is that figuring out what a piece of code is trying to accomplish takes more time than writing it originally.<br>
<br></div><div>Do you really want to match "Msg-iD" (lower case i)? Or are you only allowing "ID" or "Id"?<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
<br>
</div>Not that I'm aware of.<br>
<div class="im"><br>
> the regex should match  Msg-id:, Msg-Id, ...  but not  msg-id: and so on.<br>
<br>
</div>What's the use-case for this?<br>
<br>
The way I would typically do something like this is build my regexes in<br>
all lower case and .lower() the text I was matching against them.  I'm<br>
curious what you're doing where you want to enforce case sensitivity in<br>
one part of a header, but not in another.<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Joel Goldstick<br>
</div></div>