Harold Hallikainen wrote: >> What is the actual requirement... your description is somewhat vague... >> but I am certain a relatively concise function will suffice given the >> relative structure of URL's. > > This is part of a closed captioning system for digital cinema. I get a > Resource Presentation List from the cinema server. It's an XML file that > includes the URLs for each of the caption files (typically one for each > reel and language). These URLs are typically absolute, but may be relative > to the URL of the RPL. So, I need a function where I can pass in my new > URL, a base URL, and get back an absolute representation of the new URL. > So, I think I need to be able to handle relative URLs that include such > things as > > ./file > ../file > ../../path/path/file > /path/file Not really a problem, I think. /./file /../file /../../path/path/file //path/file These should all work fine. (Note that duplication of the slash is generally not a problem. Depends on the file system of the server, but at least with Windows and Linux systems this works.) That's what a relative path is: it's the path portion after the base path. So I don't really understand what you think you may need to parse. Just append the relative path to the base path (with a trailing slash, e.g. "http://myserver/myTopLevelDir/") and you should be done. To find out whether a path is relative or absolute depends on what kind of paths you can expect on the input. If it's either a complete http URL (starting with "http:") or a relative path, then that's it: check for a starting "http:". It seems to me that a regex parser is a bit overboard for this :) Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist