I've been trying to use regular expression in a PowerShell
script in tandem with arrays so that if I call the value $Array[0] how would I
include the regex modifier to make it end of line. or really any regex values.
foreach-object {$_ -replace $array[0], "Change"}
foreach-object {$_ -replace $array[0]$, "Change"}
foreach-object {$_ -replace $array[0]"$", "Change"}
foreach-object {$_ -replace "$array[0]$", "Change"}
$array[0]"$" "$array[0]$"
all error out. It just doesn't know what to do with the "$". The only way I've got this working is with explicit strings
instead of an array I have "123$" but obviously this is not very
conducive to a dynamic script.
foreach-object {$_ -replace "123$", "Change"}