Sounds like you want to do a bunch, so I'd define an array of objects like this.
var str = 'The FBI and NASA work for the US government'
var abbr = [
{
short: 'FBI',
long: 'Federal Bureau of Investigation'
},
{
short: 'NASA',
long: 'National Aeronautics and Space Administration'
},
{
short: 'US',
long: 'United States'
}
];
Then loop over them and replace like this:
for (var a = 0; a < abbr.length; a++) {
str = str.replace(abbr[a].short, abbr[a].short + ' (' + abbr[a].long + ')');
}
Then you can console.log(str)
and you get
FBI (Federal Bureau of Investigation) and NASA (National Aeronautics and Space Administration) work for the US (United States) government