Regular expression-mask

Can you help me with this also
input - “111-111-111”
output- “xxx-xxx-111”

1 Like

Hi @emm

System.text.regularexpressions.match(strinput,"\d).trim.substring(0,6).replace(“111”,“xxx”)

Thanks
Ashwin S

thank you Ashwin for the reply…this is not working

Hi,

Hope the following helps you.

System.Text.RegularExpressions.Regex.Replace(strInput,"\d+-\d+-(\d+)","xxx-xxx-$1")

Regards,

here you go with the expression
this will look for any value even apart from 111 or any value with - as delimiter inbetween

stroutput = 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

this worked as well

Cheers @emm

thank you so much :smile:

1 Like

Cheers @emm

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