Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> I think your regex has multiple issues. I don't have time at the moment to really dig into it, but wanted to offer an alternative approach. #2082

Closed
davnex opened this issue Sep 22, 2023 · 1 comment

Comments

@davnex
Copy link

davnex commented Sep 22, 2023

          > I think your regex has multiple issues. I don't have time at the moment to really dig into it, but wanted to offer an alternative approach.
switch -regex ($vssadmin){
    "^\w.*'(?<Name>.*)'$" {$ht = @{Name = $matches.name}}
    "^\s+(?<Name>\w[\w\s]*): (?<Value>.*)$" {
        $ht.Add($matches.Name,$matches.Value)
        if($matches.Name -like '*err*'){
            [PSCustomObject]$ht
        }
    }
}

I miss some output with this code

Originally posted by @B-Art in PowerShell/PowerShell#19754 (comment)

@andyleejordan
Copy link
Member

I don't understand why this was opened here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants