I need to replace part of a string, but I don't know every character that needs to be replaced. For example, I have a string like this:
'<text align="left" fontSize="123" color="#000000">'
I need to replace whatever value is between the quotes after fontSize. This value could be "123", "12", "0", "xyz", or anything really.
I know it is something like this, but I don't fully understand:
var string = '<text align="left" fontSize="999" color="#000000">',
newSize = 18;
string = string.replace(/fontSize="(.*)"/g, 'fontSize="' + newSize + '"');
Any help would be much appreciated. Thanks.