I am using javascript .replace function to replace match content/pattern but problem it replace match content but didn't get the comma associate with, Like:
i have var a = 'gJDjOw0ern8,-4oCq2Vw4GQ,fjsrhmUhK60';
and b = 'gJDjOw0ern8,-4oCq2Vw4GQ';
and i want to remove only match values, like the above example have i need this output after replace:" a = 'fjsrhmUhK60';
But what i am getting is: a =' ,fjsrhmUhK60';
everytime values replace but the associate comma didn't replace with empty or space.
my code: a = a.replace(b,'');
i don't want to remove all commas, reason after every unique value have its comma separator,
5 unique values have 4 commas:
654987987dsfdsf,5487987fsdfdsfsd,dsf8ds7987987,dsfdsfd779,sdfdsfdf
so only want to remove the matched value and the associated comma with space or empty.