(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ora)))
I want to replace the HOST name with a new value using powershell, Thank you
Use the -replace
operator:
$str = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ora)))'
$str -replace '(?<=\(HOST = )[^)]+', 'newhost'