I am using powershell script to replace some content of the text which is in a javascript file
var i = {
production: !0,
myBaseURL: "https://www.sample.com/api/",
}
(Get-Content -literalPath $pathToJsFile -raw) -replace "https://www.sample.com",
"https://www.newserver.com"|
Out-File $jspath -encoding UTF8
I want to replace this using regex as it can be anything instead of "https://www.sample.com" I tried
$file -replace "myBaseURL\s*: .*", "myBaseURL: $([char]34)https://www.newserver.com([char]34),"
is there a cleaner way to do this ?