我在 Powershell 脚本中有这一行:
if (Select-String -Path "$holidays" -Pattern "(?<!\*)$datestr" -SimpleMatch -Quiet)
$holidays 是一个文本文件,其中我有一些日期:
2023-09-04
2023-11-23
*2023-11-24
2023-12-25
Run Code Online (Sandbox Code Playgroud)
$datestr 是今天日期:2023-11-23
为什么负向后看模式在上面的行中不起作用?
我只是想排除(不匹配)所有以 * 开头的日期
我认为负向回顾中有问题,因为该行:
if (Select-String -Path "$holidays" -Pattern $datestr -SimpleMatch -Quiet)
Run Code Online (Sandbox Code Playgroud)
工作完美 --> 结果是正确的
第一行结果为 false
我希望在以下xts对象中转换为数字所有数字.
Morover,如果可能的话,用同一列中的前一个数字替换NA
library(xts)
x <- structure(c("1176.67", "1175.37", "1196.10", "1182.90", "1200.30",
"1183.20", "170.0674", "170.0586", NA, "170.1376", "170.1651",
"170.1844", "252.10", "252.07", "252.07", "252.23", "252.34",
"252.40", "616.09", "618.49", "620.44", "624.61", "626.66", "627.92",
"1.44730", "1.44430", NA, "1.43710", "1.44730", "1.44120", "5238.815",
"5238.458", "5256.423", "5261.352", "5235.514", "5182.277", "5669.918",
"5673.797", "5668.293", "5677.272", "5613.539", "5608.027", "399.106",
"398.800", "399.411", "402.521", "400.797", "401.521"), class = c("xts",
"zoo"), .indexCLASS = c("POSIXct", "POSIXt"), tclass = c("POSIXct",
"POSIXt"), .indexTZ = "GMT", tzone = "GMT", index = structure(c(1419292800,
1419379200, 1419552000, 1419811200, 1419897600, 1419984000),
tzone …Run Code Online (Sandbox Code Playgroud)