---
updatedAt: 2026-04-16T21:23:00.000Z
agentTools:
  projectIndex: https://docs.observeinc.com/llms.txt
---

# replace

```
replace(value: string, substring: string, replacement: string) -> string
```

Returns `value` with every occurrence of `substring` replaced by `replacement`, using non-overlapping whole-substring matches (equivalent to replacing all occurrences in one pass).

If any of `value`, `substring`, or `replacement` is null, the result is null. An empty `substring` is allowed by the compiler but is usually undesirable because it can match between every character; prefer [replace\_regex](function-replace_regex) when you need pattern-based substitution.

# Domain

This is a scalar function (calculates a single output value for a single input row).

# Categories

* [String](function#string-functions)

# Examples

<OpalCodeBlock code={
`make_col normalized:replace(host, " ", "_")
`}/>

Replaces every space in a host string with underscores so it can be used as a single token in paths.