Problem
At http://regex101.com, it is said that '$
will return a portion of the source string that follows the match. Yet it doesn't work like this for me.
Example
For example, I need to replace text in JSON. I need to remove some text from JSON after certain parameters.
"ReportPackage": {
"$id": "some id",
"$type": "stuff",
"ConnectionString": "REPLACE_HERE",
"FtpConfiguration": {
"$id": "some id",
"$type": "some type",
"Address": "some adress",
"Password": "REPLACE_HERE",
"Username": "REPLACE_HERE",
"BaseDirectory": "some path"
},
"PgConnectionString": "REPLACE_HERE"
}
},
"CurrentFederation": "",
"CurrentVirtualHost": "/",
"PgConnectionString": "REPLACE_HERE",
"PeriodicContinuationActivated": true
I need to replace the values marked as REPLACE_HERE
. I can use four separate regexes but I want to use single one(if possible).
My Attempt to Solve the Problem
I use this regex $'((("Password")|("ConnectionString")|("PgConnectionString")|("Username")))(.*),
yet it doesn't work as I imagined is would. What did I do wrong?