I have a string [R1A_0001, R1A_0002, R1A_0003, R1A_0004, R1A_0005] which I need to convert into array in Powershell.
$scripts = "[R1A_0001, R1A_0002, R1A_0003, R1A_0004, R1A_0005]"
Write-Output $scripts
$scripts = $scripts -replace '[\[|\]]','"'
$scripts = $scripts -replace '[,]','","'
$scripts = $scripts -replace '[ ]',''
$scripts = @($scripts)
I would expect to get an array out of this code, but instead I get "R1A_0001","R1A_0002","R1A_0003","R1A_0004","R1A_0005" - still a string... Please help