I want to automatically correct the proper format of IDs found on a website:
So im detecting if a specific digit-number is present in a website with
if (window.location.href.match(/\d{10}/)) { alert('ID detected');} else { alert('does not contain an ID');}
e.g raw ID: "1234567899"
now i want to add a minus "-" to it for it to show like likes "123-456-7899"
The minus has to be put in 1x after the first 3 digits and 1 x after the firs 6 digits
I am struggling to find a proper code for this, does anybody might have an idea on how to make this work?