"M51DTnM54G0G1G1G1G1G1G1G1G1G1G1G1G1G1G0G1M54M54G1G0G1G0M54M54G1M54".I
Hello,I'm new to boost and regular expressions in general.I'm using sregex_iterator (and the example provided in the documentation as a base) to >search for all occurrences of "G0" in a string like these tried to use for RE: "G0", "(G0)+" >and "(G0)", but it only finds 1 occurrence for "G0" when I expected to find 4. I also need to know the position of each occurrence.Thanks in >advance.Tulio Cleber Bender
Unless you show us some code, there's no way we can tell what you're doing wrong. You can get the position of each match like this: int main() { boost::regex e("G0"); std::string t("M51DTnM54G0G1G1G1G1G1G1G1G1G1G1G1G1G1G0G1M54M54G1G0G1G0M54M54G1M54"); boost::sregex_iterator i(t.begin(), t.end(), e), j; while(i != j) { std::cout << i->position() << std::endl; ++i; } } which prints: 9 37 49 53 HTH, John.