gpt4 book ai didi

powershell - PowerShell:获取两个字符串之间的数据

转载 作者:行者123 更新时间:2023-12-02 23:58:21 25 4
gpt4 key购买 nike

我已经将下一个数据放入变量$ out中(类型为Object []):

Success...
Go!
0:#217> trace && .quit
0x000 Subline : _OK
0x008 Timed : NO
0x016 Check : _OK
0x022 Post :
0x030 Offset : None
0x038 Hint : False
0x050 NextHint : False
quit:

我需要在字符串 0:#217> trace && .quit 退出之间提取文本:
我写:
[Regex]::Match($out, "(?<=.quit').+?(?=quit:)").Value

但这会将所需的数据提取到一行(字符串类型)而不是列(Object [])中。如何解决这个问题?

P.S.
我自己解决了这个问题,如下
([Regex]'(?is)(?:(?<=\.quit).+(?=quit:))').Match(($out -join "`n")).Value

但是,也许有更完美的方法可以做到这一点?

最佳答案

问题解决了

([Regex]'\s+0x([^q]+)').Match(($out -join "`n")).Value

关于powershell - PowerShell:获取两个字符串之间的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37193061/

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