Answer the question
In order to leave comments, you need to log in
Powershell how to replace last 2 characters in each word?
Please help me, I have a variable that contains a full name in the form "Ivanov Ivan Ivanovich", I can't figure out how to replace the last 2 characters of each word with * due to poor knowledge of the language, so that in the end it would turn out like this "Ivan* Ivan* Ivanov*
Answer the question
In order to leave comments, you need to log in
"Иванов Иван Иванович" -replace '\w{2}(\s|$)','*$1'
First, split your variable into an array, change it through replace, and reassemble it into a string.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question