What version of Go are you using (go version)?
go1.10.1
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
amd64
darwin
What did you do?
https://play.golang.org/p/oB5SCKv4LUx
r := strings.NewReplacer("aaa", "xxx", "bbbaaa", "yyy")
fmt.Println(r.Replace("bbbaaa")) // yyy
What did you expect to see?
I expected Replace to return bbbxxx.
The documentation says:
Replacements are performed in order, without overlapping matches.
I expect the aaa->xxx replacement to happen first so the second replacement bbbaaa->yyy shouldn't happen.
What did you see instead?
yyy
What version of Go are you using (
go version)?go1.10.1
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env)?amd64
darwin
What did you do?
https://play.golang.org/p/oB5SCKv4LUx
What did you expect to see?
I expected Replace to return
bbbxxx.The documentation says:
I expect the aaa->xxx replacement to happen first so the second replacement bbbaaa->yyy shouldn't happen.
What did you see instead?
yyy