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

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -