Given the text:
foo: bar
I would like to replace anything following "foo: " with "baz", but I want to keep "foo: ". This could be done with a capturing group like this:
s/(foo: ).*/$1baz/
Which results in the text:
foo: baz
Example 1
or we could use \K,...