I have a file with multiple expressions like $REGX('CareMedic.2_0','CustomerInformation','Customer Information')
. The file can be an xml file, text file or any other type. If the file contains nine of those expressions, I'm trying to pull all nine.
I've written my code as below:
$input_path = ‘C:\Users\rparpani\Desktop\test2.xml’
$output_file = 'C:\Users\rparpani\Desktop\test2.text'
$regex = '\$REGX'
$output = select-string -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } > $output_file
Write-Output($output)
Something seems to be wrong with my regex expression. Can someone please suggest the right way to achieve this?