var string=”removespace : dont remove spaces”;
need a regex which replaces all spaces before and after colon ‘:’ .
above variable must be returned as
“removespacedont remove spaces”
[CODE]var string="removespace : dont remove spaces"; var str = string.replace(/s+:s+/g, ''); //insert colon : in the '' if you want the colon left in alert(str);[/CODE]
Help @johns221b spread the word by sharing this article on Twitter...