【发布时间】:2016-01-17 16:37:04
【问题描述】:
我想匹配文本文件中的以下多行。
[1750256247]
;Rev: B,5
我尝试跟随,但未能成功。你能帮帮我吗?
$fileContent | Select-String "(?smi)(^[1750256247](-|\s*$))(^;Rev: B,5$)" -AllMatches | Foreach {$.Matches} | Foreach {$.Value}
【问题讨论】:
-
你也可以使用
$fileContent | Select-String "(?i)\[1750256247][-\s]*;Rev: B,5" -AllMatches | Foreach {$_.Matches} | Foreach {$_.Value} -
npinti 对我也不起作用。你试过
$fileContent | Select-String "(?i)\[1750256247][-\s]*;Rev: B,5" -AllMatches | Foreach {$_.Matches} | Foreach {$_.Value}吗?顺便说一句,您是指\r\n换行符还是<br>? -
嗨 stribizhev,是的,我也试过你的。同样的事情发生了。我不明白为什么。我的意思是 [CR][LF]
-
可能是因为问题不清楚?
-
字符串如下:[1750256247][CR][LF];Rev: B,5[CR][LF]
标签: regex windows powershell multiline