Summary
This PhenixID Solution Document (PSD) is written for PhenixID Identity Manager (IM) 5.4.1 or later.
There are two different control filters to replace or remove values in a string attribute. Which filter to use depends on how complex your scenario is.
System Requirements
- PhenixID Identity Manager 5.4.1 or later.
Overview
- Both filters can be added to the following events:
- init
- presave
- postsave.
- You can use one of the filters to remove a value, use the string “NOVALUE” as the replacement value.
Replace Value by String
Scenarion
You like to replace a string (a character or word) with something else.
Filter
replaceCharInString located in filter.Nordicedge
The filter takes 2 string parameters. The first one is the string that you want to replace and the second one is the replacement value.
Example 1
If value three exists then replace that with value 3
Configure replaceCharInString filter parameter 1 with value “three” and parameter 2 with parameter “3”
Result:
Attribute value before filter: Simon Smith three
Attribute value after filter: Simon Smith 3
Example 2
If value – exists then remove the –
Configure replaceCharInString filter parameter 1 with value “-“ and parameter 2 with parameter “NOVALUE”
Result:
Attribute value before filter: Pet-er
Attribute value after filter: Peter
Example 3
If a space exists in string then remove the space
Configure replaceCharInString filter parameter 1 with value ” “ and parameter 2 with parameter “NOVALUE”
Result:
Attribute value before filter: Pet er P a n
Attribute value after filter: PeterPan
Replace Value by Regular Expression
Scenarion
If the value you want to replace is more complex than a simple string then you can use regular expression.
Filter
replaceCharInStringByRegex located in filter.PhenixID
The filter takes 2 string parameters. The first one is a string with a regular expression which matches the characters or strings you want to replace, and the second one is the replacement value.
Example 1
Only allow a-z in the attribute value, and replace any other character with -.
Configure replaceCharInStringByRegex filter parameter 1 with value “[^a-z]“ and parameter 2 with parameter “-“
Result:
Attribute value before filter: simon smith2
Attribute value after filter: simon-smith-
DISCLAIMER
Information provided in this document is for your information only. PhenixID makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.The origin of this information may be internal or external to PhenixID. PhenixID makes all reasonable efforts to verify this information.
PhenixID - support.phenixid.se