Answer the question
In order to leave comments, you need to log in
Powershell how to remove extra characters from a variable?
I get the text from the Word file into certain variables, but I came across the fact that in addition to the text in the variable there are a lot of line breaks and incomprehensible characters, please tell me how it is possible to clean up all unnecessary? At the moment, I settled on the fact that I remove all spaces and hyphens and cut off 1 character from the end, but somehow it does not always
work
correctly
. .ru
"line break"
"line break"
and of course I can't send anything to such an email, help kind people.
Answer the question
In order to leave comments, you need to log in
Hard way - cut off everything that can't be in normal mail, like
$mail = $mail -replace '[^a-z0-9\.\[email protected]_=]' # what other characters are there....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question