Alan Baugher

Notepad++ and Regular Expression:  Convert case in LDIF files

Discussion created by Alan Baugher Employee on Aug 24, 2017
Latest reply on Sep 28, 2017 by Pasquale_Russo



Recently had a request from a site, to help manage a case challenge with data within a userstore.  The userstore was being populated by a HR solution, via the IM bulk loader client. 


Challenge:  During initial loading and ongoing loading, 10% of the uid: strings were in upper case, and about 100% the managerid: strings is upper case.


The CA Identity Management/Portal solution are case-insensitive.  The login uid case becomes a challenges when integrating with the CA Identity Governance solution.  






We broke this challenges into two (2) areas:   initial data clean-up; and adjusting the onboarding business logic.


This discussion is how to use the Regular Expression within Notepad++ to rapidly search/replace on case and replace those values for a userstore's LDIF export.

- Note:  If the userstore is on a UNIX/Linux servers, it is also possible to do this process with sed, awk, or perl.





Step 1:   Identify the strings that need to be updated, e.g.  uid:  ABC,   managerid:  DEF


Step 2:   Use a design tool for Regular Expression.

- Several are available but a useful one for Notepad++ was


Step 3:  Introduce some sample data and then use the designer tool, to build the correct search pattern and the replacement pattern.   These will be used later in Notepad++.





Where the search pattern is:  (\buid: \b)([A-Z]+)

And the replacement patter is: \1\L\2\E


Another example:



Where the search pattern is:  (\buid: \b)(.[A-Z].)

And the replacement patter is: \1\L\2\E



Step 4:   After you are satisfied, copy these search/replacement patterns to your Notepad++ GUI; and then submit to update the LDIF exported file.







Step 5:  Import the updated file into the Directory solution, e.g. if CA Directory use either dxloaddb  or dxmodify command(s).





Let me know if you found this useful.