I am working in Go, I have a text file in which I want to replace a text based on a regex, but it's not working as expected even when I already tested the regex here and it says that there's a match.
I made the basic example in play ground and I am getting the same result. I have 3 text files with the same label (//==start== and //==end==), it works for the first one, but no for the second and third. What can be avoiding the regex to replace correctly the text?
https://play.golang.org/p/nZdHg5IfZ89
This is the code that I used, I pasted all the string because I want to be sure that it's not the one affecting me
package main
func main() {
var re = regexp.MustCompile(Myregex)
s := re.ReplaceAllLiteralString(originalString,"replaced")
fmt.Println(s)
}
var Myregex = `\/\/==start==
(.+
)*\/\/==end==`
var originalString = `// @Author: someone
// @Date: 2018-01-23T16:46:09-04:00
// @Email: dddddddd@gmail.com
// @Filename: _material.themes.scss
// @Last modified by: Someone
// @Last modified time: 2018-01-23T18:40:39-04:00
@include angular-material-theme($theme);
.app-dark {
@include angular-material-theme($dark-theme);
}
.app-pink {
@include angular-material-theme($pink-theme);
}
//==start==
//==end==`