How do I remove possible code from strings and replace it with blank?
For example:
Input =
9eac83a4-80f4-4a2e-b0fe-7a4a9329ff62Manual Handling.pdf
Desired Output = Manual Handling.pdf
Input =
14a19827-8f33-4666-a3cc-ea257875f1f7Fire&Evac.pdf
Desired Output = Fire&Evac.pdf
Input =
67a89d74-57a9-43cc-9576-001f9315d292BLS-1.pdf
Desired Output = BLS-1.pdf
Input =
7622a004-43b8-4357-8c95-c8a269e6ef7827276e859ef10d-Mango Super.pdf
Desired Output = Mango Super.pdf
Input = d5b0f745aa80d9- Calc.png
Desired Output = Calc.png
Input =
d5b0f745aa80d9980d090- Covid-19-Test.png
Desired Output = Covid-19-Test.png
Input =
d5b0f745aa80d9980d090-2a004-43b8-4357-8 Covid-19 Vacc.png
Desired Output = Covid-19 Vacc.png
Can someone help me achieve this?
I've tried this regex but it's not working for all the cases mentioned above:
var str = "9eac83a4-80f4-4a2e-b0fe-7a4a9329ff62Manual Handling.pdf";
var cleanStr = str.replace(/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/g, "");
Any assistance would be greatly appreciated. Thank you!