Strip all non letters and numbers from a string in Powershell? -


i have variable has string recieves strange characters hearts.

besides point, wanted know anyhow: how leave string letters , numbers, discarding rest or replacing nothing (not adding space or anything)

my first thought using regular expression wanted know if powershell had more native automatically.

let have variable this:

$temp = '^gdf35#&fhd^^h%(@$!%sdgjhsvkushdv' 

you can use -replace method replace non-word characters this:

$temp -replace "\w" 

the result be:

gdf35fhdhsdgjhsvkushdv 

Comments

Popular posts from this blog

Upgrade php version of xampp not success -

amazon web services - S3 and apache mod_proxy with basic authentication -

powershell - This solution contains one or more assemblies targeted for the global assembly cache -