I want TypeScript code which uses Regular Expression to first understand repeated words or numbers in a string (like ‘2024’ or ‘May’) and then replace the first matched ones with empty.
Examples:
// Change '27 May 2024 - 02 Jun 2024'
// To '27 May - 02 Jun 2024'
// Change '20 May 2024 - 26 May 2024'
// To '20 - 26 May 2024'
Any generic regex which can do the above is so appreciated.
Thanks a heap 🙂