[clug] Help with a python regexp?

Jeremy Kerr jk at ozlabs.org
Sun Feb 22 01:29:46 GMT 2009

Hi Brad,

> So how to I match a line containing "warning:", as long as it doesn't
> start with "exchange.idl"?

You want the (?!...) grouping operator. From 'pydoc re':

 (?!...)  Matches if ... doesn't match next.

For example:

 warning_re = re.compile('(?!exchange.idl).*warning[: ].*')



More information about the linux mailing list