This is my string. I want to replace everything that is not between '{' '}'.
@═strin3http://schemas.microsoft.com/2003/10/Serialization/??║{
"Content-Type":"application/json",
"PlanUrl": "https://dev.azure.com/{org}/",
"ProjectId": "030a1c12-2657-4168-bfcb-27da2d7bfd94",
"HubName": "build",
"PlanId": "4c38913c-30c2-44cb-a3a6-a6c9533d5b73",
"JobId": "a4f1cc8a-0ccb-5e90-36f4-f06f41d0ce59",
"TimelineId": "4c38913c-30c2-44cb-a3a6-a6c9533d5b73",
"TaskInstanceId": "fab2c9a5-dd69-59cd-9de4-4a87ae16ee9f",
"AuthToken": val }╔
So I use -replace
and [regex]::Match( $msContent , '\{(.*?)\}')
but it seems I am very bad in this.
How can I get this
{
"Content-Type":"application/json",
"PlanUrl": "https://dev.azure.com/{org}/",
"ProjectId": "030a1c12-2657-4168-bfcb-27da2d7bfd94",
"HubName": "build",
"PlanId": "4c38913c-30c2-44cb-a3a6-a6c9533d5b73",
"JobId": "a4f1cc8a-0ccb-5e90-36f4-f06f41d0ce59",
"TimelineId": "4c38913c-30c2-44cb-a3a6-a6c9533d5b73",
"TaskInstanceId": "fab2c9a5-dd69-59cd-9de4-4a87ae16ee9f",
"AuthToken": val }