#pragma once
#pragma warning(disable:4996)
#define _SCL_SECURE_NO_WARNINGS
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <regex>
#include <iterator>
#include <algorithm>
using namespace std;
int main() {
string seq("tatagcagtcccgctgtgtgtacgacactggcaacatgaggtctttgctaatcttggtagctttg");
regex e("(tata)([gatc]*)(tag)");
int submatches[] = { 1, 2, 3 };
sregex_token_iterator rend;
sregex_token_iterator a(seq.begin(), seq.end(), e, submatches);
while (a != rend) std::cout << " [" << *a++ << "]";
getchar();
return 0;
}
26 November 2017
Example on how to use C++ regex_token_iterator
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment