【发布时间】:2021-06-22 09:41:08
【问题描述】:
我正在努力编写一个简单的报告脚本。 例如
$report.FullFormattedMessage = "This is the deployment test for Servername for Stackoverflow in datacenter onTV"
$report.FullFormattedMessage.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object
现在我想挑出一些特定的词,比如...
$dc = should be the 'onTV'
$srv = should be the 'Servername'
$srv = $report.FullFormattedMessage.contains... or -match ?? something like this?
.split()[] 的技巧对我不起作用,因为 $report 有时看起来不同。我怎么能这样做?
【问题讨论】:
标签: regex powershell output select-string