Zdravko Monov wrote:
Dear boost-users,
I am currently working on a C++ project that includes reading and parsing some files. Given a string with certain file contents S, I would like to attempt to compare it against a certain pattern. In particular, the contents have the form key : value. Certain keys are obligatory, while others may or may not exist (my program then supplies the default values). Can you recommend me a boost facility that can help me reading this type of data? My problem is that between key, : and value there could be blank spaces, tabs etc. The type of value could be a string, an int, or double.
It sounds like Boost.Xpressive would be a good fit for you. It's a regex engine that lets you nest actions with the regex. Here is an example that does pretty much exactly what you're looking for: parses a string containing key/value pairs into a std::map. http://www.boost.org/doc/libs/1_38_0/doc/html/xpressive/user_s_guide.html#bo... HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com