[Zope] easy regular expression for URL fixup

Ed Colmar ed@greengraphics.net
Wed, 6 Mar 2002 16:29:40 -0800


Hey Tom

Thanks again...

I'm trying these out in python for checking...  Still I cannot get any
matches...  I am really wondering if my install is botched.  Does this work
on yours?

>>> import re
>>> HTMLFILE=r'/\\w*\\.html'
>>> htmlfile=re.compile(HTMLFILE)
>>> url = "http://www.somewhere.com/folder/test.html"
>>> m = htmlfile.match(url)
>>> print m
None

>>> HTMLFILE=r'/.*\.html'
>>> htmlfile=re.compile(HTMLFILE)
>>> m = htmlfile.match(url)
>>> print m
None

>>> HTMLFILE=r'[a-z]*\.html'
>>> htmlfile=re.compile(HTMLFILE)
>>> m = htmlfile.match(url)
>>> print m
None

>>> HTMLFILE=r'.*\.$'
>>> htmlfile=re.compile(HTMLFILE)
>>> m = htmlfile.match(url)
>>> print m
None


>>> HTMLFILE=r'.*'
>>> htmlfile=re.compile(HTMLFILE)
>>> m = htmlfile.match(url)
>>> print m
<_sre.SRE_Match object at 0x00AB2110>

>>> HTMLFILE=r'.*\.html'
>>> htmlfile=re.compile(HTMLFILE)
>>> m = htmlfile.match(url)
>>> print m
<_sre.SRE_Match object at 0x00ABCEB0>