I've been messing with this for a little while now, but I can't get this
to work. How do I match the last occurence of '\' in a string? I want to
remove the file name from a url (e.g. news/breakingnews/981001b.html -->
news/breakingnews/ ).
Here is the simplest version (that doesn't work). It matches the _first_
backslash.
import regex
file_in = open( 'dir.txt', 'r+' )
for line in file_in.readlines():
print regex.search( '/', line )
Thanks for any help!
Jeff P.
to work. How do I match the last occurence of '\' in a string? I want to
remove the file name from a url (e.g. news/breakingnews/981001b.html -->
news/breakingnews/ ).
Here is the simplest version (that doesn't work). It matches the _first_
backslash.
import regex
file_in = open( 'dir.txt', 'r+' )
for line in file_in.readlines():
print regex.search( '/', line )
Thanks for any help!
Jeff P.