JSFiddle - React, Tailwind, and code Playground

HTML

<div id="wrap">NAS dui pellentesque pretium augue. MTCP pellentesque pretium augue. NAS ac ornare lectus MTCP nec.</div>

CSS

acronym {
    background: yellow;
}

JavaScript

var acronyms = {
       'NAS': 'Nunc ac sagittis',
       'MTCP': 'Morbi tempor congue porta'
    };
    
    var current = $('#wrap').text();

    for(var name in acronyms) {
        var regex = new RegExp(name);
        current = current.replace(regex, '<acronym title="' + acronyms[name] + '">' + name + '</acronym>');
    }

    $('#wrap').html(current);