Regex Replace Attributes
Use regex-replace-attributes
to specify a regex to search for attributes in a request or response body and replace their values with a regex replacement string.
Description | Details |
---|---|
Applicable to |
All, although you cannot apply the Regex Replace Attributes statement directly to a System for Cross-domain Identity Management (SCIM) search. |
Additional information |
The payload for this statement is either a JSON object or an array of JSON objects. Each object represents a single replacement operation and has up to four keys. The following list describes these keys:
PingAuthorize replaces any portion of the attribute value that matches the regular expression in the The regular expression and replacement string must be valid as described in the API documentation for the java.util.regex.Pattern class, including support for capture groups. |
For example, consider the following body.
{
"id":5,
"username":"jsmith",
"description":"Has a registered ID number of '123-45-6789'.",
"secrets":{
"description":"Has an SSN of '987-65-4321'."
}
}
Also, consider the following payload.
{
"path":"$.secrets",
"regex":"\\\\d{3}-\\\\d{2}-(\\\\d{4})",
"replace":"XXX-XX-$1"
}
Applying the advice produces the following body with a changed "secrets.description"
value.
{
"id":5,
"username":"jsmith",
"description":"Has a registered ID number of '123-45-6789'.",
"secrets":{
"description":"Has an SSN of 'XXX-XX-4321'."
}
}