In the variable extractor panel you have an option called "Value is encoded". If you choose the custom item in the drop down list you can edit a Javascript in order to modify your extracted value on the fly.
I guess in your case you can use a replace method to automatically replace all your ref: by ref:A strings.
Example:
function decode(encodedValue) {
var decodedValue = encodedValue.replace(/ref:/g, "ref:A");
//Apply decoding logic here.
//JS Libraries can be used
return decodedValue;
}