In PowerShell, how do unescape the unicode escaped strings?
$str1 = "http:\u002f\u002fgoogle.com\u002fsomething\u002ftest"
to
http://google.com/something/test
The code to do this is:
[Regex]::Replace($str1, "\\[Uu]([0-9A-Fa-f]{4})",
{[char]::ToString([Convert]::ToInt32($args[0].Groups[1].Value, 16))} )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With