reg = /\d{2}\.\d{2}\.\d{4}/g; str = " 30.07.2017 30.07.2017" str = str.replace(reg, '<div class="vrotego">$&</div>'); alert(str)