On Sat, Jan 31, 2009 at 1:44 PM, Jay Jesus Amorin <jay.amo...@gmail.com> wrote: > Thanks bob. > > I want to search any characters in test after https://www.localhost.org/ and > the search will end after it finds another / > > and when i print it will display testmodule.
If *all* you want is the first element of the path, you can get that simply by splitting the string on / and retrieving the correct piece: In [28]: test Out[28]: 'https://www.localhost.org/testmodule/dev/trunk/admin/sql/mytest.sql' In [29]: test.split('/') Out[29]: ['https:', '', 'www.localhost.org', 'testmodule', 'dev', 'trunk', 'admin', 'sql', 'mytest.sql'] In [30]: test.split('/')[3] Out[30]: 'testmodule' Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor