You can pass the replacement function to the replacement method. The first argument for which is the whole match, the second will be $ 1. In this way:
mystring.replace(/<([\w]+)[^>]*>.*?<\/\1>/, function(a,x){
return a.replace(x,x.toUpperCase());
})
, ( , ):
mystring.replace(/<([\w]+)([^>]*>.*?<\/\1>)/, function(a,x,y){
return ('<'+x.toUpperCase()+y);
})