I have a string
str = 'first last1; first last2; first Last3;';
I am looking to remove the spaces only after the semicolons.
I have tried using
str = str.replace(';' + /\s+/g, ';');
and
str = str.replace((';' + /\s+/g), ';');
but it is not working.
any help would be appreciated.
str.replace(/;\s+/g, ';');? Concatenating a string with a regular expression won't produce the result you might expect.