Script Runner help needed

Beth Starr January 10, 2019

I have a field that is pulling information from Active Directory which contains a string of text including user names.  I need to remove everything in this field except for the user names.

Example:

CN=User1,OU=Accounts,OU=Company,DC=company,DC=int, CN=User2,OU=Accounts,OU=Company,DC=company,DC=int,CN=User3,OU=Accounts,OU=Company,DC=company,DC=int,

If I use the following I can remove some of the text but how do I read through the string and get rid of only certain information so that only user names remain?

def DR = "OU=Accounts,OU=Company,DC=company,DC=int,"
DR.replaceAll(/^OU=Accounts,OU=Company,DC=company,DC=int,/, "")

If I try to add the CN= to the replaceAll then I get the whole string back.

How can I skip the user and the following comma and delete the rest of the information?

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events