|
Posted by John Dunlop on 04/11/06 21:16
Jiri Fogl:
> Regular expression I need has to search through path or URL and find
> every reference to a parent directory, including this parent directory.
>
> For example if I have URL like this:
> http://www.example.com/mydir/../myotherdir
> RE is supposed to match /mydir/../ so I can replace it by a single slash
> and get "definite" URL.
Sorry, I don't know how you'd do that with a regular expression, even
with a PCRE.
Does it need to be done with a single RE? If not, RFC3986 gives an
example algorithm for removing dot segments (sec. 5.2.4), and the whole
algorithm of section 5.2 is definitive, so I would refer to it anyway.
http://www.ietf.org/rfc/rfc3986.txt
--
Jock
[Back to original message]
|