Trying to remove numbers after the last hyphen. I tried the below but not working.
const str = 'HYC-HTY-VB23';
const result = str.toLowerCase().replace(/-\d*$/, "");
console.log('result = ', result);
If I change it to \w it removes all the values after the last - hyphen but I only want the numbers after the last hyphen to be removed. Anyone have any ideas around this in regex.
Thanks,