Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Replace Non-Alphabetic Characters in String

$
0
0

Summary: Use Windows PowerShell to replace non-alphabetic characters in a string.

Hey, Scripting Guy! Question How can I use Windows PowerShell to replace a string that contains non-alphabetic characters
           (such as commas and periods)?

Hey, Scripting Guy! Answer Use the –Replace operator, and specify a regex pattern '[^a-zA-Z]', for example:

$a = 'Never a foot too far, even.'

$a -Replace '[^a-zA-Z]',''


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>