for example:
var str=\"hihi\";
to replace the last(second) ,
to change into \"<
\"<
I think you want this:
str.replace(/^(.*)(.*?)$/, '$1$2')
This greedily matches everything from the start to a , then a , then ungreedily matches everything to the end.