summaryrefslogtreecommitdiff
path: root/src/regexp/regexp.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/regexp/regexp.go')
-rw-r--r--src/regexp/regexp.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/regexp/regexp.go b/src/regexp/regexp.go
index d7d0edb993..42ae6e1d7a 100644
--- a/src/regexp/regexp.go
+++ b/src/regexp/regexp.go
@@ -454,7 +454,7 @@ func Match(pattern string, b []byte) (matched bool, err error) {
// in Expand, so for instance $1 represents the text of the first submatch.
func (re *Regexp) ReplaceAllString(src, repl string) string {
n := 2
- if strings.Index(repl, "$") >= 0 {
+ if strings.Contains(repl, "$") {
n = 2 * (re.numSubexp + 1)
}
b := re.replaceAll(nil, src, n, func(dst []byte, match []int) []byte {