Description Details

Applicable to

All, although you cannot apply the Regex Replace Attributes statement directly to a 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:

"regex"
Represents the regular expression to use to find the attribute values to replace. This key is required.
"replace"
Represents the regex replacement string to use to replace the attribute values with a new value. This key is required.
"path"
A JSONPath expression that represents the nodes to start searching under. The expression can point to objects, arrays, or strings in the body. This key is optional.
"flags"
A string that contains the regex flags to use. Recognized flags include:
  • "i"

    Performs case-insensitive matching.

  • "l"

    Treats the "regex" value as a literal string.

  • "c"

    Performs "canonical equivalence" matching.

PingAuthorize replaces any portion of the attribute value that matches the regular expression in the "regex" value in accordance with the "replace" replacement string. If multiple substrings within the attribute value match the regular expression, PingAuthorize replaces all occurrences.

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 statement 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'."
   }
}