JSFiddle - React, Tailwind, and code Playground

by techtiger255

JavaScript

var str2 = "and 1 2 3!", 
    str = "I can count to 3 4 5";

str = str.replace(/\d+/g, function(match, capture) {
    return match -2; // subtract
});
document.write(str+" ");

str2 = str2.replace(/\d+/g, function(match, capture) {
    return match -(-2); // add
});
document.write(str2);

//keeping the style
document.body.style.background = "white";