- <#*,:&cls
- @echo off
- pushd "%~dp0"
- powershell -NoProfile -ExecutionPolicy RemoteSigned -Command ". ([ScriptBlock]::Create((Get-Content -LiteralPath \"%~0\" -ReadCount 0 | Out-String ))) "
- popd
- pause
- exit /b
- #>
- $htmlfile = "解析json1.txt"
- $re = [regex]"(?<traceId>(?<traceId_1>`"traceId`"\s*:\s*)(?<traceId_2>`".*?`"(?<!\\`")|null))"
- $txt = [System.IO.File]::ReadAllText($htmlfile)
- $re.Matches($txt) | ForEach-Object { $_.Groups['traceId_2'].Value.Trim('"') }
复制代码
|