Find and replace string in body
APPLIES TO: All API Management tiers
The find-and-replace
policy finds a request or response substring and replaces it with a different substring.
Note
Set the 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
- Policy sections: inbound, outbound, backend, on-error
- Policy scopes: global, workspace, product, API, operation
- Gateways: classic, v2, consumption, self-hosted
Example
<find-and-replace from="notebook" to="laptop" />
Related policies
Related content
For more information about working with policies, see:
- Tutorial: Transform and protect your API
- Policy reference for a full list of policy statements and their settings
- Policy expressions
- Set or edit policies
- Reuse policy configurations
- Policy snippets repo
- Author policies using Microsoft Copilot for Azure
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om