I am trying to use regex in powershell to replace text on a per line basis but it results in the entire line being replaced with the desired value but without the original leading text and with an unwanted dollar sign.
Example file with lines to replace:
server.ssl.keystore-password=ffdsfsa
server.ssl.key-password=ffdsaf
Example Regex:
KeyStorePassword='4Z9dwVQn6wSk5H3kWX2SsxGWhZ/jTUrwgDSyfYNCxN0='
'(server.ssl.key-password=).*',("`$1$KeyStorePassword")
But what ends up happening is it instead replaces the line as followed:
$4Z9dwVQn6wSk5H3kWX2SsxGWhZ/jTUrwgDSyfYNCxN0=
When the desired outcome is
server.ssl.key-password=4Z9dwVQn6wSk5H3kWX2SsxGWhZ/jTUrwgDSyfYNCxN0=