regular expression question: last occurence

Gerrit Holl gerrit.holl at
Sat Jun 12 12:02:42 EDT 1999

Hello all,

I want to get the _last_ occurence of some string in some other string. What
I want exactly, is having the current directory (for example,
and than put everything after the last "/linuxgames" in a string. But when
someone is in the directory "/home/gerrit/linuxgames/cvs/linuxgames", my current
regexp is getting /cvs/linuxgames, and that's not what I want. Now, I have:

currentdir = os.getcwd()
mo ='/linuxgames', currentdir)
eind = mo.end()
subdir = currentdir[eind:] + '/'

But that doesn't solve my problem.

kind regards,

The Dutch Linuxgames website.		De Nederlandse Linuxgames pagina.
Everything about games on Linux.	Alles over spelletjes onder Linux.
Site address:
Personal homepage:

More information about the Python-list mailing list