Skip to content

Instantly share code, notes, and snippets.

@manualbashing
Last active November 6, 2019 14:18
Show Gist options
  • Save manualbashing/4d03cedc05ec88e57c7a to your computer and use it in GitHub Desktop.
Save manualbashing/4d03cedc05ec88e57c7a to your computer and use it in GitHub Desktop.
Replace Umlauts in #PowerShell with a replace function and regular expression
$replaceUmlaut = {
param ($Match)
$characterMap = New-Object System.Collections.Hashtable
$characterMap.ä = 'ae'
$characterMap.ö = 'oe'
$characterMap.ü = 'ue'
$characterMap.ß = 'ss'
$characterMap.Ä = 'Ae'
$characterMap.Ü = 'Ue'
$characterMap.Ö = 'Oe'
$characterMap.$Match
}
[Regex]::Replace('Lüsterner Spaß mit öligen Äpfeln.', '([ÄÖÜäöüß])', $replaceUmlaut)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment