Reputation: 1352
How would I remove the {} around a string like the following? {636D9115-E54E-4673-B992-B51A8F8DDC8B} I just want to return the following: 636D9115-E54E-4673-B992-B51A8F8DDC8B
Upvotes: 3
Views: 13261
Reputation: 26120
Using trim :
"{636D9115-E54E-4673-B992-B51A8F8DDC8B}".trim('{}')
Using multiple replace :
"{636D9115-E54E-4673-B992-B51A8F8DDC8B}".Replace('{','').Replace('}','')
Using Replace with RegEx
"{636D9115-E54E-4673-B992-B51A8F8DDC8B}" -replace '\{(.*)\}','$1'
Using pure RegEx :
"{636D9115-E54E-4673-B992-B51A8F8DDC8B}" -match '\{(.*)\}'
$Matches[1]
Upvotes: 7