[Edit]
+
0
-
0
js regex remove everything before certain character (excluding)
1 2 3 4 5 6 7 8 9 10 11const regex = /-.*$/; const text = 'Removed part - Example text...'; const match = text.match(regex); if (match) { console.log(match[0]); // '- Example text...' } else { console.log(text); }