我想在PowerShell 7.2.4中删除某个字符串的某些部分,该怎么办?
我有字符串“ url”:“ https://maven.fabricmc.net/net/fabricmc/fabricmc/fabric-installer/0.11.0/fabric-installer-0.11.11.0.jar”
。我想从字符串中删除所有内容,但https://maven.fabricmc.net/net/fabricmc/fabricmc/fabric-installer/0.11.11.0/fabric-installer-0.11.11.0.jar
(我想要也要删除报价)。
我该怎么做?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想到的最短
可能具有不正确的索引,只需测试切换“ 3”
The shortest I could think of
Might have the incorrect indexnumber, just test switching '3'
您可以使用
-replace
操作员并提取所需的部分。但是,由于这似乎是JSON格式,您可能会在整个内容上使用
Convertfrom-Json
,然后通过DOT表示法访问属性。这要比尝试将JSON的匹配部分或字符串匹配部分容易得多。
You could use the
-replace
operator and extract the section you want.However since this appears to be in JSON format you may be better off using
ConvertFrom-Json
on the entire thing and then accessing the property through dot notation.It's slightly easier than trying to regex or string match sections of JSON.