I'm writing a piece of Groovy that needs to capture multiple instances of a pattern in a string. Specifically, the string should look something like this:
"Blah blah blah blah key1:value1 key2:value2 blah blah blah key3:value3"
I need to capture: key1:value1, key2:value2 & key3:value3.
I think the regex should look something like this
def regex = ~/[^|\s](.+:.*)[$|\s|\n]/
What do I need to do to capture all instances of the pattern in the string?