in reply to Incorrect Pattern Matching Behavior

Allow me to rewrite your regular expression so that you can see the problem more easily:

/^ThisPartDoesNotMatchAndIsInFactIrrelevantToYourProblem|OUTPUT\s*\)/

Try it. With the case insensitivity, it will still match. Do you see the problem now? It can be corrected by using grouping (e.g., non-escaped parens) to specify more precisely what you really meant (update: as hv shows very nicely).


Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. Why, I've got so much sanity it's driving me crazy.