
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 09:12 AM
I currently have the below business rule that searches the description field to find "Password: xxxxxxxxx" and removes the characters that follow the colon and replaces it with "Password Removed" So If I was to type "Password: TestPW!" the business rule below would replace it with "Password: Password Removed". I need to write an or statement to check for "Password:xxxxxxxxx" and perform the same replace action.
Currently searching for "Password: 123456789" with space after the colon
Need to add an or statement to search for "Password:123456789" with no space after the colon
Current Business Rule
(function executeRule(current, previous /*null when async*/) {
var rgx = new SNC.Regex('/Password: [0-9]*/');
var result = current.description;
current.description = rgx.replaceAll(result,"Password: Password Removed");
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 11:05 AM
I see. Well, there are a couple things.
1. The 'SNC Regex' method of doing this seems to not be the recommended way to proceed (see: Convert SNC Regex expressions to enhanced regex expressions).
2. I rewrote the script using the above suggestions, but encountered the same issue. I don't usually use SNC.Regex api (or the plain javascript regExp constructor); I do it inline, so to speak.
In our instance, replacements are made in the following method. I haven't found any issues doing it this way, but someone else might be able to chip in on the best practices. In your case it is working as expected.
var result = current.description;
current.description = result.replace(/Password:[\s]?[\w!]*/g, "Password: Password Removed");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 09:22 AM
Regex('/Password:[\s]?[0-9]*/') should work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 09:52 AM
When typing "Password: 123" with the space after the colon it is replacing it with "Password: Password Removed 123". It should be removing "123".
When typing Password:123" with no space, it works as expected, replacing "123" Password Removed".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:18 AM
It's an interesting case, especially considering the possibility of a pass-phrase and what other characters may appear in a password, depending on the password complexity rules you use.
Would you be able to provide more information regarding what the use case would be?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:35 AM
Hi Dylan
I have users opening incidents, and demands and sometimes the user inputs passwords. The majority of the records that contained passwords where written in the following format, "Password: Test!" or Password:Test!". I want to removed the characters the follow "Password:".