[Tutor] Iterating through a list of replacement regex patterns

David Hutto smokefloat at gmail.com
Fri Sep 3 20:51:03 CEST 2010

On Thu, Sep 2, 2010 at 11:05 PM, David Hutto <smokefloat at gmail.com> wrote:
> I just added +'*' to select in re.search(select+'*', str(readfile[:])),
> and it now shows the same in both.
> But if you have any input on modifications let me know.
> Thanks,
> David

Still a problem. When I use the re.search(select+'*', str(readfile))
the asterisk  for re matches it to any character, so if there are any
letters of the word it matches.

I would like to match the exact word being sent not just any of the
characters, and the only way is with the exact word nothing following it,
but substituting the string parameter with the word even str(word), it
always shows negative for a match, search or findall.

So does this have something to do with the extra len on the str(wordfromlist)
as stated in the first email, and if so how do I remove whats there.

If not, what is the, probably small, thing I'm not doing to the item being
used as the re.search/findall parameter?


More information about the Tutor mailing list