Boost Users :
Subject: Re: [Boost-users] Trouble with regex
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-28 14:58:31
Nathan Huesken wrote:
> I have some trouble with regex.
> I have a string in this format:
> =?<encoding>?<Q or B>?<name>?=
If you want a literal question mark, you need to escape it: "\\?"
> I want to extract the encoding, Q or B and name!
> I read the regex documentation and
> I try this:
> string mime_decode_field(string field)
> boost::regex e("^=?([\x20-\x7E]*)?(Q|B)?([\x20-\x7E]*)?=$",boost::regex::perl|boost::regex::icase);
> boost::smatch what;
> //Now I expect <encoding> in what, <Q or B> in what and <name> in what
> But it is not as expected. what and what are empty, what
> contains the whole string.
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