Hoping an experienced coder could explain why a variable create from contents of a text file and added to a match pattern does not work...but a variable with a static string does?
$computer = "TYMXL-F3MC012WV"
$s_01 = (Get-Content $path\source_files\pascodes.txt -Raw).replace("`n","|") #F3MC|FRSE|FGTS
$s_02 = "F3MC|FRSE|FGTS"
$computer -match "^(TYMX|MPLS)(W|L|T|V)-($s_01)([a-zA-Z0-9]{1}).+$" #false
$computer -match "^(TYMX|MPLS)(W|L|T|V)-($s_02)([a-zA-Z0-9]{1}).+$" #true
Aucun commentaire:
Enregistrer un commentaire