$ZuDI = @("P", "DI", "SF") $EAZahl = "PF0001" $EANurZahl = $EAZahl -replace "[\d]" Write-Host $EANurZahl if ($EANurZahl -in $ZuDI) { Write-Host "Ist enthalten" } else { Write-Host "Ist nicht enthalten" } #Write-Host $($($EAZahl.Substring(0,2)) -in $ZuDI) <# foreach ($Eingang in $ZuDI) { if ($EAZahl.Contains($Eingang)) { Write-Host "Ist enthalten bei Eingang " $Eingang } # Todo: Schleife verlassen, nachdem ersten positives Ergebnis vorliegt # Was passiert, } #> <# if ($($EAZahl -match $ZuDI )) { Write-Host "Ist enthalten" } else { Write-Host "Ist nicht enthalten" } #> <# if ($EAZahl -in $ZuDI) { $EAZahl = $EAZahl.Remove(0,2) $EAZahl = "DI" + $EAZahl #replace }#>