Reputation: 478
I'm trying to write a regex to filter the values, that exist between curly braces:
Example: $path = C:\serices\ApplicationName\{{NewFolderName}}
I want to filter the value "NewFolderName" from the above variable. Once I execute, I want to see "NewFolderName"
in my output. I'm using PowerShell version 2.0. Can someone please suggest me the possible solution.
Thanks in advance.
Upvotes: 1
Views: 436
Reputation: 82
Here's the full powershell for your question.
$path = "C:\users\{{XXX}}\Downloads\{{YYY}}\AppName"
$matches = [regex]::Matches($path,"\{{2}(.*?)\}{2}").value
Upvotes: 1