gpt4 book ai didi

powershell - 使用 powershell 替换链接中的字符

转载 作者:行者123 更新时间:2023-12-03 23:11:26 25 4
gpt4 key购买 nike

我想替换 ?

"EquipmentInfo["?"] = "<iframe src='http://bing.fr'></iframe>";"

通过变量。

我尝试过这个:

(get-content C:\word.txt) -replace '?', '$obj' | Set-Content C:\word.txt

最佳答案

我会使用积极的回顾来确保您找到正确的问号。此外,您还必须在替换项上使用双引号,因为您想替换变量:

(get-content C:\word.txt -raw) -replace '(?<=EquipmentInfo\[")\?', "$obj" | Set-Content C:\word.txt

使用的正则表达式:

(?<=EquipmentInfo\[")\?

Regular expression visualization

关于powershell - 使用 powershell 替换链接中的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37679977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com