我想在 HTML 中删除一个自我强加的区域。我已经制定了正确的正则表达式,我已经在Expresso中证明了这一点,并且正确的部分被突出显示。
我在多行模式下运行它,并将此设置设置为 PowerShell 正则表达式字符串
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
}
遗憾的是,尽管该文件已被触及,但该区域并未被删除。