---
title: "zero-replacement-limit"
description: "Detect replacement calls with a zero limit."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# zero-replacement-limit

**Default severity:** `warning`

The final argument to `strings.Replace` and `bytes.Replace` is the maximum
number of replacements. Zero replaces nothing. Use a negative value or the
corresponding `ReplaceAll` function to replace every occurrence.

## Bad

```go
strings.Replace(value, old, replacement, 0)
```

## Good

```go
strings.ReplaceAll(value, old, replacement)
```

Source: https://strider.gempir.com/analyzers/zero-replacement-limit/index.mdx
