Implemented test and fix for variable replacement with additional text before/after expression.