I have some strings in the following possible forms:
MYSTRING=${MYSTRING}\n
MYSTRING=\n
MYSTRING=randomstringwithvariablelength\n
I want to be able to regex this into MYSTRING=foo
, basically replacing everything between MYSTRING=
and \n
. I've tried:
re := regexp.MustCompile("MYSTRING=*\n")
s = re.ReplaceAllString(s, "foo")
But it doesn't work. Any help is appreciated.
P.S. the \n
is to indicate that there's a newline for this purpose. It's not actually there.