Exclude few Special characters while generating password using transforms

Hi Team,

We have a requirement to build random password excluding set special characters while creating an account.
I have used below code to generate password but not able to exclude few special characters.
“nonEmployeeCode”: {
“attributes”: {
“name”: “Cloud Services Deployment Utility”,
“operation”: “generateRandomString”,
“includeNumbers”: “true”,
“includeSpecialChars”: “false”,
“length”: “14”
},
“type”: “rule”
}

Is this requirement feasible using transforms. Any help is appreciated.
Thank you,
Rajesh

Hi @Rajesh_Thota1,

What characters are not excluded when you try this?

I am not sure why special characters are still included when you have specified it as false. But here’s a transform you could try:

{
    "attributes": {
        "input": {
            "attributes": {
                "name": "Cloud Services Deployment Utility",
                "operation": "generateRandomString",
                "includeNumbers": "true",
                "includeSpecialChars": "false",
                "length": "14"
            },
            "type": "rule"
        },
        "table": {
            "[^a-zA-Z0-9]": ""
        }
    },
    "type": "replaceAll",
    "name": "Test Replace All Transform"
}

It will remove all non alphabetical and non numerical value

Hi @atarodia,

Thank you for the quick response. We want exclude “0:;<=>?@O`^/I1|ilI” characters.

Can you give me suggestion how to exclude the above mentioned characters.

Thank you,
Rajesh Thota

If you want to exclude just the ones you mentioned, then you can change the table to

 "table": {
      "[0:;<=>?@O\\`^/I1|ilI]": ""
    }

You can also create a replace table like this:-

    "table": {
      "0": "",
      ":": "",
      ";": "",
      "<": "",
      "=": "",
 }

You can have regex expression or single characters that you want to replace in the replaceAll table that would help you to remove all characters which you want.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.