 
             if (match_tag(token, "SM"))
                 sample = value;
+
+            pos = temp.find(delimiter);
         }
     }
 };

 */

#include <string>
#include <regex>

#include "../alignment_data.h"
#include "alignments.h"

    read_group(const std::string& header_line)
    {
        // split string at each tab character
        // note that we don't use std::regex because it seems to be unavailable on common Linux installations
        const std::string delimiter = "\t";
        std::string temp = header_line;
        size_t pos = 0;
        std::string token;

        pos = temp.find(delimiter);
        while(pos != std::string::npos)
        {
            token = temp.substr(0, pos);
            temp.erase(0, pos + delimiter.length());

            // skip TG:
            auto value = token.substr(3, token.length() - 3);

