Search code examples
c++regexboostboost-regex

Boost regexp how to parse Cookie string into map<string, string>?


So Cookie strings look like remixsettings_bits=1; wysiwyg=1,2,3,abc; remixclosed_tabs=0; remixgroup_closed_tabs=786432; remixlang=0; remixchk=5; remixsid=35d4f9907281708019490d07728c27ca5c10e5de7a869c322222225e3219e; audio_vol=100 I wonder how to parse tham into map name <-> value?


Solution

  • Try this regex: (\w+)=([^;]*)

    1. \w+ - alphanumeric one or more repetitions
    2. =
    3. [^;]* - any character except ; any number of repetitions

    Result: enter image description here