PowerShell -Part 7 (537レス)
PowerShell -Part 7 http://mevius.5ch.net/test/read.cgi/tech/1701241669/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
424: デフォルトの名無しさん [sage] 2025/04/26(土) 21:00:04.39 ID:arwW7ZGW >>423 なんで変数の対応がめちゃくちゃなの? 正規表現で力技でやるとこんなところだが xmlとして読み込めばnode削除でいけそうな気がする Add-Type -AssemblyName Microsoft.VisualBasic $html = Get-Content "D:\Download\test\sample.html" -Raw # KWクラスdivを正規表現で削除 $pattern = [regex]"^((?:(?'open'<div[^>]*?>[\r\n]*))|(?'close-open'</div>)|(?:(?!</?div[^>]*>)[\s\S])+?)*(?(open)(?!))" $processedHtml=$pattern.replace($html,{ $r=$args.value $e=0 $args.groups['3'].captures| sort index| ?{$_.index+$_.length -gt $e -and $_.value -cmatch '<div.*class="KW"'}| %{$e=$_.index+$_.length; $r=[Microsoft.VisualBasic.Strings]::replace($r,$_.value,"",1,1)} $r }) $processedHtml | Out-File "D:\Download\test\pit.html" -Encoding UTF8 http://mevius.5ch.net/test/read.cgi/tech/1701241669/424
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.939s*