Say I had a string
String s = "foofoo bar barbarbar foo
and I wanted to find all the occurrences of foo and print them out like so:
foo foo foo
I've already looked into StringUtils, but it seems to me (an amateur) that this library is only able to count the number of occurrences of foo. Is there something I'm doing wrong here? Or is regex really the best way to go?