Replace Function
Replace Function

Replace Function

This function is used to replace the ad attribute value with replace string.
Params JSON parameters for replace function
Attribute Name
Data Type
Description
value
String
Value field on which regex pattern is applied. This could be the combinations of one or many AD attributes or constants strings.


For example; if the AD attribute value of
extensionattribute7 is 10245-0843-SRE-Apparel,
${extensionattribute7} is evaluated as
10245-0843-SRE-Apparel

If the value requires backslash (\) or double quotes, then these characters should be escaped with another backslash (\).For example, the value pttpro\${givenname} should be given as pttpro\\${givenname}
search
String
Search pattern to be applied.
If the value requires backslash (\) or double quotes, then these characters should be escaped with another backslash (\). For example; pattern ^\d{4} should be given as ^\\d{4}
replace
String
Replace the string for all the search patterns.


Search pattern is checked by ignoring the case.

max (optional)
Interger
Number of occurrences to replace.


Default value: -1 (ALL) – Case sensitive


1 – Replace first string – Case sensitive


N – Replace nth string – Ignore Case

Example
Map the user attribute department to the AD attribute extensionattribute7. The extensionattribute7 value in AD is 1024-0843-SRE-Apparel.
Function mapping for department attribute
{" function":"replace", "params":{ "value":"${extensionattribute7}", "search":"1024", "replace": "software" }
It replaces all search strings 1024 in extensionattribute7 AD attribute value with replace string software and map to user attribute department.
In the above example 1024 is replaced with software. The user attribute department uis set with value of software-0843-SRE-Apparel.
If the key is not found in the map, it does not replace the string.