|
Boost Users : |
From: soleani (soleani_at_[hidden])
Date: 2002-01-17 00:17:42
Hi there,
not sure how I could write that Subject line. Sorry :-)
Here's the thing, I have a file with the following:
KEY1 = ${short_localhost}
KEY2 = bbbf<control2.cfg:OTHER_SECTION:${long_localhost}>aaaf:<he
I need to extract the value between the {} when it starts with a $.
My expression works ok for KEY1 (the value part, the string to the
right
of the equal sign), however it doesn't match for the value for KEY2.
This is what I have:
static const boost::regex expression( "\\$\\{(.*?)\\}" );
boost::cmatch what;
if ( boost::regex_match( input, what, expression ) )
{
cerr << "GOT IT!" << endl;
}
else
{
cerr << "NOPE" << endl;
}
where input is a std::string with the value described above.
Why does it work for KEY1 and not KEY2?
Interestingly enough, if I do the following:
KEY1 = dd${short_localhost}
it doesn't match either.
This same expression in Perl works fine though.
thanks,
-Anibal
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