---
title: "replace"
canonical: "https://support.appfire.com/space/PSCONF/15303142/replace"
format: markdown
---
> Macro (aura-html)

> Macro (table-plus)
> 
> |  |  |  |  |
> | --- | --- | --- | --- |
> | **Syntax** | replace(str, search_str, replacement_str) | **Package** |  |
> | **Alias** |  | **Pkg Usage** |  |

## Description

> Macro (excerpt)
> 
> Replaces the **search_str** string with **replacement_str** in **str** and returns the resulting string.

Replaces the **search_str** string with **replacement_str** in **str** and returns the resulting string. The string **str** is not modified.

## Parameters

> Macro (table-plus)
> 
> | Parameter name | Type | Required | Description |
> | --- | --- | --- | --- |
> | str | String | Yes | Specifies the string to replace characters for. |
> | search_str | String | Yes | Specifies a character expression to search for in str. |
> | replacement_str | String | Yes | Specifies the string that replaces search_str. |

## Return Type

**String**

## Examples

### Example 1

```javascript
wret = replace("foobar", "foo", "bar");
print(wret);
```

Print **barbar**

### Example 2

```javascript
wret = replace("aaa", "aa", "b");
print(wret);
```

Print **ba**

## See also

> Macro (contentbylabel)