[Tutor] Matching multiple regular expressions
Tzu-Ming Chern
T.Chern at unibas.ch
Wed Jan 12 23:05:04 CET 2005
Hi Python Tutors,
Is there a more elegant solution to matching multiple regular expressions?
An example would be:
lista = ['hello','goodbye','bubblegum'] # lista would contain my regular
expressions I want to match
My file would look something like this:
line1: blah blah aldkfslfjlajf hello
line2: blah blah dkajfldjfjkdsfalj zippo
line3: blah blah lkdsjalkfjkj bubblegum
line4: blah blah skdjflsdjlkj ditto
What I want to do is to only print out those lines that don't contain
those patterns included in lista. So that would be lines 2 and 4.
Any suggestions?
cheers,
tzuming
More information about the Tutor
mailing list