Fw: [regex]How to get Content-Type's parameter pairs using boost.regex?
Hi, experts,
I using boost.regex parse the content-type header's value in MIME.
A typical content-type's BNF like following:
Content-Type = "Content-Type:" SP media-type
media-type = type "/" subtype *( ";" gen-param )
type = token
subtype = token
gen-param = pname [ "=" pval ]
pname = token
pval = token / quoted-string
An example content-type as following:
multipart/mixed; boundary="theboundary" ;id=33
There may be zero or one more parameters in content-type.
My parse code as following:
#include
Mockey Chen wrote:
I want to get the parameter "boundary" and its value.
Any way to do it?
Yes, but you need to recompile the regex lib with captures support enabled, see http://www.boost.org/libs/regex/doc/captures.html and scroll down to the "repeated captures" section. HTH, John.
participants (2)
-
John Maddock
-
Mockey Chen