cls # PowerShell RegEx with Groups as result # Help from https://mcpmag.com/articles/2015/09/30/regex-groups-with-powershell.aspx $txt1 = $NULL $res1 = $NULL $txt1 = "#SCAN#DD-Eingangsrechnung" #$res1 = ($txt1 | Select-String -pattern "(?:#SCAN#(DD-[a-zA-Z-üÜöÖäÄ]{1,}))" -AllMatches | %{$_.matches} | %{$_.value}) $res1 = ([regex]::Match("$txt1", "(?:#SCAN#(DD-[a-zA-Z-üÜöÖäÄ]{1,}))").Groups[1].Value) echo $res1