Boost logo

Boost Users :

From: Reena Dass (Reena.Dass_at_[hidden])
Date: 2008-06-02 14:50:52


I'm trying to write a parser for URIs. I tried the grammar straight from
RFC 2396

boost::regex
parser("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?",

            boost::regex::perl|boost::regex::icase);

 

This does not work since it I get an exception due to invalid regular
expression.

 

I found another regular expression, which does not throw an exception
but does not give me the parts of the URI using boost::match_result

boost::regex
parser("(([a-zA-Z][0-9a-zA-Z+\\-\\.]*:)?/{0,2}[0-9a-zA-Z;/?:@&=+$\\.\\-_
!~*'()%]+)?/{0,1}([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@
&=+$\\.\\-_!~*'()%]+)?",

            boost::regex::perl|boost::regex::icase);

 

What am I doing wrong here?

 

Reena

 



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net