Following up on my previous question about using Golang's regex to replace between strings. I now have a bit of complexity added to it. Here is what the contexts of my file looks like:
foo:
blahblah
MYSTRING=*
bar:
blah
blah
MYSTRING=*
MYSTRING=
var re = regexp.MustCompile(`(MYSTRING=).*`)
s := re.ReplaceAllString(content, `${1}stringofmychoice`)
But now I need to match and replace only after a certain occurrence. So that the contents of my file can look something like this:
foo:
blahblah
MYSTRING=foostring
bar:
blah
blah
MYSTRING=barstring
ReplaceAllString
docker-compose.ymlMYSTRINGfoobar