function removeHTMLTags(txt, preservedTags) {
			if (preservedTags === undefined || preservedTags.length === 0) {
				return removeAllHTMLTags(txt);
			}

			return txt.replace(/<\/?([^>]+)>/g, function (match, tag) {
				if (preservedTags.indexOf(tag.split(" ")[0]) === -1) {
					return '';
				}
				return match;
			}).replace(/\s{2,}/g, ' ');
		}
Removes HTML tags from a string, except for those specified in the preservedTags array.
@param {string} txt - The input string.
@param {string[]} [preservedTags] - An optional array of HTML tags to preserve.
@return {string} The input string with HTML tags removed.