I had an issue where I needed to support
search and replace of certain quoted strings in various scripts which take the
form of $(VARNAME). There’s a minor issue with Java where if the replaced by
string contains certain characters where it will quit with an unhelpful message
like “IndexNotFound: Match group 5 not found” or something similar. This is how to
resolve that error, and the importance of escaping things.