Ver originalvar rgxp = new RegExp('!(sad|happy|dizzy)', 'g');'!happy'.replace(rgxp, '<img src="images/$1" />'); // "<img src="images/happy" />"