If the input is
11100011100000011
the largest sequence of 0's is at
000000 (pos: 9)
I tried
regex re0("(.*)([0]+)(.*)");
regex_search(sch, m, re0);
for (unsigned i = 0; i<m.size(); ++i) {
std::cout << "match " << i << " (" << m[i] << ") ";
std::cout << "at position " << m.position(i) << std::endl;
}
But it gives my wrong results
11100011100000011
match 0 (11100011100000011) at position 0
match 1 (11100011100000) at position 0
match 2 (0) at position 14
match 3 (11) at position 15
How do you make the [0]+ greedy to find the largest match?
Aucun commentaire:
Enregistrer un commentaire