mao
7/6/2017 - 9:18 AM

Get-Matches() gets all regex matches. Answers question "How do I iterate through text file and print all matched regex groups for each lin

Get-Matches() gets all regex matches. Answers question "How do I iterate through text file and print all matched regex groups for each line in file?"

Get-Content SomeFile.ps1 | 
    ForEach { Select-String '(?i)^function\s+([^{( ]+)' -input $_ -Allmatch } | 
    ForEach { $_.matches.groups[1].value }