Is it possible to convert the next character after each "_" sign in to capitals?
eg:
var myString = "Taylor_swift";
var rg = /(_)/gi;
myString = myString.replace(rg, function(toReplace) {
    $("#textField").val( toReplace.toUpperCase() );
});
Is it possible to convert the next character after each "_" sign in to capitals?
eg:
var myString = "Taylor_swift";
var rg = /(_)/gi;
myString = myString.replace(rg, function(toReplace) {
    $("#textField").val( toReplace.toUpperCase() );
});
 
    
    You can try
var myString = "Taylor_swift";
var rg = /_(.)/gi;
myString = myString.replace(rg, function(match, toReplace) {
  return ' ' + toReplace.toUpperCase();
});
console.log(myString);
$('#result').html(myString)<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="result"></div> 
    
    You can create a custom javascript function
function myUpperCase(str) {
  if (str.indexOf("_") >= 0) {
var res = str.split("_");
res[0] = res[0].toUpperCase();
str = res.join("_");
  }
  return str;
}
var myString = "Taylor_swift";
var upCase = myUpperCase(myString);
$("#result").html(upCase);<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="result"></div> 
    
    Try also:
var txt = "Taylor_swift_more_text".replace(/[^_]+/g, function(a){
   return a.charAt(0).toUpperCase() + a.substr(1)
}).replace(/_+/g," ");
document.write(txt) 
    
    Yes, you can use the split method on the string:
myWords = myString.split('_');
myWords[1] = myWords[1].toUpperCase();
To capitalize only the first letter, use this:
myWords[1] = myWords[1].charAt(0).toUpperCase() + myWords[1].slice(1);
