regexp match string with word1 and not word2
Flyzone
flyzone at technologist.com
Mon Apr 30 11:20:58 EDT 2007
James Stroud ha scritto:
> The P.S: suggests homework, but this can't be homework because python
> regex won't do this, so your teacher gets an F if its homework. You
Not a homework, but a "workwork" :-)
I'm writing a script to parse logfiles, and I have began to study
python for this (bash was too much slow).
When i'll finishi it, I'll post a link here if someone think that
could be helpful.
> require a negative look-behind assertion of variable length--not
> possible in python regex. You will have to use something else--or maybe
> you don't understand the homework problem.
I was asking that cause in the code i wrote this:
for y in range(0, len(skip_lst) ):
if (re.search(skip_lst[y], line)):
skip=1
break
In skip_lst there are the regexp and strings (on one line) to match
with "line".
But rarely the rules to be matched need to have also a logical And.
What could be the solution? Add another array with a "not" regexp?
More information about the Python-list
mailing list