Regular Expression question

looping kadeko at gmail.com
Thu Oct 25 02:34:03 EDT 2007


Hi,
It's not really a Python question but I'm sure someone could help me.

When I use RE, I always have trouble with this kind of search:

Ex.

I've a text file:
"""
create or replace package XXX
...

create or replace package body XXX
...
"""
now I want to search the position (line) of this two string.

for the body I use:
s = re.search(r'create\s+or\s+replace\s+package\s+body\s+', txt,
re.IGNORECASE)

but how to search for the other line ?
I want the same RE but explicitly without "body".

Thanks for your help.




More information about the Python-list mailing list