[Tutor] regular Expressions

Annika Scheffler annika.scheffler@gmx.net
Tue, 8 Oct 2002 18:17:14 +0200 (MEST)


Hi all!

I have a problem with regular Expressions. I want to loop through each word
in a file and find that word and the next 25 characters in another file.

I tried it like that:

import re

for eW in sortedFile:
     mat = re.search(eW, "...........................", readFile)

I also tried that one:

import re

for eW in sortedFile:
    mat = re.search("eW.................", readFile)

I know the second version is NOT what I want. I don't actually search the
characters "eW", eW is a variable that stands for eachWord in the file.
But the first version doesn't work either. Why not?
And what is the proper way to do it?

Thanks a lot,

Annika

-- 
Ravens fly in flights, but the egale flies
alone.

+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!