I have a line like
var str=" , this, is a ,,, test string , , to find regex,,in js. , ";
in which there are several spaces at the beginning, middle and end of the line with commas. I need this line in
var str="this is a test string to find regex in js.";
I found a lot of regex in the forums to remove spaces, commas separately, but I could not join them to remove both.
Please explain, if possible, regex syntex.
Thanks in advance
javascript regex
Dashrath
source share