Filter a list of strings in powershell by a regex, then group and sort by one of the capture groups

Solution 1:

In answering and researching for this question on SO, I believe I have a solution that's alligned to your original intent.

No doubt this can be shortened further (this code-golf should sort that out) but this would work for what you have posted

 ? {$_ -match '^(ACBXYZ-\d+)'} | group {([Regex]::Match($_, [Regex]::new('^(ACBXYZ-\d+)'))).Value} | % {($_.group | sort le*)[0]}

Try-it-online