It looks like you closed the for loop too late. Lines 21-23 should be outside the loop.
Move the } on line 27 to line 20 and remove the break. It works. I just tested it in the C++ shell here. It even extracts the 123 from hello123abc
EDIT: Just for fun, I did this earlier after seeing your thread title.
Extract all of the integers from a string and stuff them into a vector: