I have a function in which I need to replace "byte" with "$ball". This doesn't seem to work correctly. Here is the program snippet.
fun main() {
str := []byte("$apple in a byte
")
strReplace := "$ball"
re := regexp.MustCompile("byte")
final := re.ReplaceAll(str, []byte(strReplace))
ioutil.WriteFile("testfile.txt", final, 0744)
}
Expected Output in testfile.txt: $apple in a $ball
Actual Output in testfile.txt: $apple in a
Any solutions for successfully getting the desired output?