The title to process
Processed title
export function processTitle(title: string): string {
const withoutParentheses = title.replaceAll(/\s*\([^()]*\)\s*/g, " ");
return withoutParentheses
.replaceAll("-", " ")
.replaceAll("\u2018", "'") // Left single quotation mark
.replaceAll("\u2019", "'") // Right single quotation mark
.replaceAll("\u201C", '"') // Left double quotation mark
.replaceAll("\u201D", '"') // Right double quotation mark
.replaceAll("_", " ")
.replaceAll(/\s{2,}/g, " ")
.trim();
}
Process a title by removing parenthetical content and normalizing characters.