---
title: std.replace_prefix
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/strings/std-replace-prefix
---

```
STRING std.replace_prefix(STRING s, STRING target, STRING replacement)
```

**Available in:** all subroutines

Replaces the literal string `target` in string `s` with `replacement`
if `s` begins with that prefix.

This corresponds to `std.prefixof(s, target)` returning `true`.
If `pattern` is the empty string, the original string `s` is returned.

## Example

```vcl
std.replace_prefix("0xABCD1234", "0x", "") # returns "ABCD1234"
```
