I have file with some variables in it like this:
${variable}
And i want to loop through file and output:
variable
variable1
variable2
variable3
etc.
My code:
function GetStringBetweenTwoStrings($firstString, $secondString, $importPath){
#Get content from file
$file = Get-Content $importPath
#Regex pattern to compare two strings
$pattern = "$firstString(.*?)$secondString"
#Perform the opperation
$result = [regex]::Match($file,$pattern).Groups[1].Value
#Return result
return $result
}
GetStringBetweenTwoStrings -firstString "\\${" -secondString "}" -importPath ".\start.template"
EXAMPLE of input file line:
<input id="paymentMethod_VISA" type="radio" name="${input.cardType}" value="VISA" checked="checked" style="width: 1.5em; height: 1.5em;"/>
Can anybody give me a hint?
Thanks