function get_clean_title(filename) { // Regex matches: [4 digits]-[2 digits]-[2 digits] [space] [4 digits] [optional space] [capture everything else] const timestampRegex = /^\d{4}-\d{2}-\d{2}\s\d{4}\s?(.*)/; const match = filename.match(timestampRegex); // If it matches your timestamp format, return the captured group (the text after) // If it doesn't match (no timestamp), return the whole filename let title = match ? match[1] : filename; // Clean up common placeholder names //if (title.toLowerCase().includes("untitled")) return ""; return title.trim(); } module.exports = get_clean_title;