powershellpowershell-7.0powershell-7.2

I want to remove certain parts of a certain string in Powershell 7.2.4, how do I do it?


I have the string "url": "https://maven.fabricmc.net/net/fabricmc/fabric-installer/0.11.0/fabric-installer-0.11.0.jar". I want to remove everything from the string except https://maven.fabricmc.net/net/fabricmc/fabric-installer/0.11.0/fabric-installer-0.11.0.jar (I want to remove the quotes as well).

How do I go about it?


Solution

  • $str = """url"": ""https://maven.fabricmc.net/net/fabricmc/fabric-installer/0.11.0/fabric-installer-0.11.0.jar"""
    $str.Split(""": """)[1].Replace("""","")