2 Jun
2008
2 Jun
'08
6:50 p.m.
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