我想删除HTML中的自强区域。我已经计算出了正确的regex,我已经在
expresso中证明了这一点,并且突出显示了正确的部分。
我在多行模式下运行此设置,并已将此设置预先设置为PowerShell Regex字符串
get childitem(get item-path“.\”-verbose).fullname-recurse-filter*.html|
foreach对象{
写主机“检查”$.fullname
$content=get content$全名
$content=$content-替换“(?m)(^.*Region Remove.*)[.*\n \w \w]*(^.*EndRegion Remove.)”,“
设置内容$content-path$.fullname
}
遗憾的是,该区域未被删除,尽管文件已被触摸。
,并突出显示正确的部分。

我在多行模式下运行此设置,并已将此设置预先设置为PowerShell Regex字符串
Get-ChildItem (Get-Item -Path ".\" -Verbose).FullName -Recurse -Filter *.html |
Foreach-Object {
Write-Host "Checking "$_.FullName
$content = Get-Content $_.FullName
$content = $content -replace "(?m)(^.*\#region REMOVE.*)[.|\n|\W|\w]*(^.*\#endregion REMOVE.*)",""
Set-Content $content -Path $_.FullName
}
遗憾的是,该区域没有被删除,尽管文件已被触摸。