[Zope] easy regular expression for URL fixup
Ed Colmar
ed@sage.greengraphics.net
Wed, 6 Mar 2002 03:07:08 -0800 (PST)
Hey!
I'm working up a quick re to give me the folder above a webpage... For
instance:
### I want: http://www.the.net/bigfolder/ ###
import re
url = "http://www.the.net/bigfolder/somepage.html"
htmlfile = re.compile("/\w*\.html")
htmlfile.match(href_url)
if htmlfile:
folder_url = htmlfile.sub(href_url, "/")
For some reason I cannot get my re to do this right...
I goit a bunch of hits while searching that indicated many people were
having trouble with re in 2.2 python. Is this the case?
Anyone know what the syntax is to compile that re?
TIA
-ed-