0

I have a string for example std::string s = " Hello as=-(Hello) asd#Hello" and a regex std::regex r(".*Hello.*")

How can I find out all the matches?

I Tried an iterator

for(std::sregex_iterator i = std::sregex_iterator(s.begin(), s.end(), r);
                            i != std::sregex_iterator();
                            ++i )
    {
        std::smatch m = *i;
        std::cout << m.str() << " at position " << m.position() << '\n';
    }

But it only shows one match.

Adam
  • 59
  • 8

0 Answers0