summaryrefslogtreecommitdiff
path: root/build/windows/lib/in-place-regex.ps1
blob: 7b30934294a9991544dee99e5392edf78b804ad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
function In-Place-Regex {
    param (
        [Parameter(Mandatory)][string]$Path,
        [Parameter(Mandatory)][string]$Search,
        [Parameter(Mandatory)][string]$Replace
    )

    $content = (Get-Content "$Path" -Encoding UTF8)
    $content = ($content -replace "$Search", "$Replace")
    [System.IO.File]::WriteAllLines((Get-Item "$Path").FullName, $content)
}