|
Boost-Build : |
Subject: [Boost-build] boost::regex_search url/uri match help
From: Simply Seven (simply7_at_[hidden])
Date: 2009-03-31 00:57:51
Hi,
I have the following regular expression for matching a URI/URL(works
fine with PCRE, note I have escaped ++ to work with boost::regex but
otherwise unchanged):
const boost::regex regex_username_password(
"("
"(?:"
"[a-zA-Z0-9_.!~*'()&=+$,;?/-]\\+\\+"
"|"
"%[0-9a-fA-F]{2}"
")+"
")"
"(?:" ":"
"("
"(?:"
"[a-zA-Z0-9_.!~*'()&=+$,-]\\+\\+"
"|"
"%[0-9a-fA-F]{2}"
")*"
")"
")?"
"@"
);
For the life of me I cannot figure out why it isn't working. The
boost::test results looks like so:
failed [10.1.2.33 != test]
... error in "test_http_url": check url == u.to_string() failed [sip:test_at_10.1.2.33
!= sip:test]
... error in "test_http_url": check url == get_uri(u) failed [sip:test_at_10.1.2.33
!= sip:test]
I believe it is the regex, here is the iterator position, etc...
std::string(*it, str.end()) == ":test_at_10.1.2.33"
iterator position = ':'
if (boost::regex_search(it, str.end(), matches, UsernameAndPassword))
{
assert(0); // never reached
}
Any help here would be great, thanks!
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk