Hi All

I’m having 2 scenarios
Scenario 1
Input: 999-999-999
Output: xxx-xxx-999
Input: 9999999999
Output: XXXXX9999

Scenario2
Input: 999-999-999
Output: xxxxxx-999
Input: 9999999999
Output: XXXXX9999

(Inputs can be alpha numeric , value and size can be also changed)

1 Like

Check this post

1 Like

To handle both the scenario together
Use this expression which is combined of both Regex that was shared earlier
In assign activity like this

str_output = IF(str_input.ToString.Contains(“-“), String.Join("-",Split(strinput.ToString,"-").Take(2).AsEnumerable().select(Function(a) System.Text.RegularExpressions.Regex.Replace(a.ToString,"(\w)",“x”)).ToArray()).ToString+"-"+Split(strinput,"-").Last.ToString,
System.Text.RegularExpressions.Regex.Replace(str_input.ToString,”^[0-9]{4}”,”****”).ToString)

Cheers @emm

thanks for replying…to do seperate these scenarios what to do

for separate scenarios
here you go two expressions
–for one with - in the string
str_input.ToString.Contains(“-“), String.Join("-",Split(strinput.ToString,"-").Take(2).AsEnumerable().select(Function(a) System.Text.RegularExpressions.Regex.Replace(a.ToString,"(\w)",“x”)).ToArray()).ToString+"-"+Split(strinput,"-").Last.ToString

–for one without - in the string
System.Text.RegularExpressions.Regex.Replace(str_input.ToString,”^[0-9]{4}”,”****”).ToString

Cheers @emm