cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: URL Parsing libraries

From: Joe Halpin <j.p.h_at_comcast.net>
Date: Thu, 29 Jan 2004 14:28:48 -0600

codemastr wrote:
>>RFC 2396 gives a regular expression that is claimed to parse URI's
>>correctly (in Appendix B). Given this regex you should be able to
>>extract, add, substitute at will given a compliant URI.
>>
>>I've not messed with it very much but it looks like it's correct from
>>what little I have done with it. However, it also gives a BNF grammar
>>for URIs in Appendix A.
>
> Yeah I'm aware of these things, but there is more to it than that. As I
> said, one of the things I want it to be able to do is to implement "user
> friendly" URLs. Using a regexp isn't going to convert the " " to a %20, not
> to mention this would mean I'd need to add a regexp library to my program
> which runs into the same problems as libwww, it has far more things than I'm
> going to need.

I haven't had time to come up with an example, but given the ability to
extract subexpressions (which the reference regex does) you could do a
simple search and replace on the appropriate subexpressions to convert
them to what you want.

As for adding a regexp library, the regex routines are part of the POSIX
spec. I confess I don't know how that works out on Windows, but if
Cygwin is installed I suspect it would work there too.

Joe

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-31