I have the following script in javascript
var idText;
var idText1;
idText = "This_is_a_test";
idText1 = idText.replace(/_/g, " ");
alert(idText1);
When I show idText1, it replaces all underscores and places in the space where they were. However, I am trying to keep the first underscore, so I get "This_is test". Is this even possible?
source
share