|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2003-12-31 06:53:37
> When I rebuild the inspect program yesterday (using VC++ 7.1), it started
> to incorrectly report some files as unlinked even though they really are
> linked.
>
> Here is an example of one of the missed links:
>
> <td><a href=
> "../tools/build/v1/borland-tools.html"><code>borland</code></a></td>
>
> A dump of the file shows the line endings are cr/nl.
>
> The regex that used to find this OK is:
>
> boost::regex url_regex(
> "<\\s*"
> "(?:A\\s+[^>]*HREF|FRAME\\s+SRC)" // A HREF or FRAME SRC
> "\\s*=\\s*\"([^\"]*)\"",
> boost::regbase::normal | boost::regbase::icase);
>
> Any ideas?
There haven't been any regex changes that would affect that in a long while,
and as the test program below demonstrates it does find the match you expect
in this case, so the error must be somewhere else,
John.
#include "boost/regex.hpp"
#include <iostream>
int main()
{
std::string s = "<td><a href=\r\n
\"../tools/build/v1/borland-tools.html\"><code>borland</code></a></td>";
boost::regex url_regex(
"<\\s*"
"(?:A\\s+[^>]*HREF|FRAME\\s+SRC)" // A HREF or FRAME SRC
"\\s*=\\s*\"([^\"]*)\"",
boost::regbase::normal | boost::regbase::icase);
boost::smatch what;
if(regex_search(s, what, url_regex))
{
std::cout << "match found: " << what[1] << std::endl;
}
else
{
std::cout << "Ooops!" << std::endl;
}
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk