I have a very long string from a database query that I have to provide as an XML file to a third party. I am trying to replace special characters like apostrophe (') with html tag '
This script doesn't throw any error but doesn't replace the characters either.
var str = (vDescription.replace(/'|&/g,function(match){
return {
'\'':'\'',
'&':'\&'
}[match]
}));
str = vFormattedDesc;
Sample data (vDescription): The QIS serves as expert & liaison in improvement with the clinical departments related to clinical documentation, clinical monitoring and improvements. Provides leadership in data collection, analysis, presenting the clinical report card at applicable meetings. Serves as a leader and or mentor in the area of Process Improvement for the organization and implementation of PI processes, as needed. Assist with Root Cause Analysis and quality reviews. Responsible for clinical databases with the quality department. Exemplifies the mission, vision and values and acts in accordance with Organizaton’s policies and procedures.
Sample Output: The QIS serves as expert & liaison in improvement with the clinical departments related to clinical documentation, clinical monitoring and improvements. Provides leadership in data collection, analysis, presenting the clinical report card at applicable meetings. Serves as a leader and or mentor in the area of Process Improvement for the organization and implementation of PI processes, as needed. Assist with Root Cause Analysis and quality reviews. Responsible for clinical databases with the quality department. Exemplifies the mission, vision and values and acts in accordance with Organizaton&aposs policies and procedures.