window.onload = function() { var replaced_element = document.getElementsByClassName("translate-price"); for (var i = 0; i < replaced_element.length; i++) { replaced_element[i].innerHTML = replaced_element[i].innerHTML.replace(new RegExp("[0-9]", 'g'), "<span>Здесь должно быть найденное число</span>"); } } It is necessary to add the opening span tag to the found numbers and the closing span tag after the number. It is necessary to somehow substitute the found number, but I can not understand how. I would be grateful for any help)