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 in Azure
Pripomienky
https://aka.ms/ContentUserFeedback.
Pripravujeme: V priebehu roka 2024 postupne zrušíme službu Problémy v službe GitHub ako mechanizmus pripomienok týkajúcich sa obsahu a nahradíme ju novým systémom pripomienok. Ďalšie informácie nájdete na stránke:Odoslať a zobraziť pripomienky pre