I am reading a file using get-childitem and passing it to select-string like so:
$regexTrans = ‘Transaction Type: [a-z]+’, 'Trade Amount: ', ‘CUSIP Number: \d+[a-z]\d+’, ‘Settlement Date: \d{2}[/]\d{2}[/]\d{2}’, ‘Fund Name [a-z]+[a-z]+[a-z]+’
$readfile = Get-ChildItem -Path C:\Test\FinancialStatements\FinStatement.txt
$Line = ($readfile | Select-String $regexTrans -AllMatches).Matches.Value
I am accessing the array like so:
$line[2] and it work fine but if I need just part of array like the date instead of ‘Settlement Date: \d{2}[/]\d{2}[/]\d’ how can I just get the \d{2}[/]\d{2}[/]\d’ part.
I am still learning and never played with regex or arrays
Thanks for helping me
I am still learning