Find and replace string in body

The find-and-replace policy finds a request or response substring and replaces it with a different substring.

Note

Set a policy's elements and child elements in the order provided in the policy statement. Learn more about how to set or edit API Management policies.

Policy statement

<find-and-replace from="what to replace" to="replacement" />

Attributes

Attribute Description Required Default
from The string to search for. Policy expressions are allowed. Yes N/A
to The replacement string. Specify a zero length replacement string to remove the search string. Policy expressions are allowed. Yes N/A

Usage

Example

<find-and-replace from="notebook" to="laptop" />

Next steps

For more information about working with policies, see: