# strReplace {#strreplace}

**Parent topic:**[Functions](../../Functions/category.md)

## Syntax {#syntax}

`strReplace(str, pattern, replacement)`

## Arguments {#arguments}

**str** is a string scalar/vector.

**pattern** and **replacement** are both string scalars.

## Details {#details}

Return a copy of *str* and replace all occurrences of *pattern* with *replacement*.

## Examples {#examples}

```
strReplace("The ball is red.", "red", "green");
// output: The ball is green.

strReplace(["The ball is red.", "The car is red too."], "red", "yellow");
// output: ["The ball is yellow.","The car is yellow too."]
```

