JSFiddle - React, Tailwind, and code Playground

JavaScript

//javascript RegEx example of replacing all the 1s with 2s
var s1 = 's1111111';
var rx = /1/g;
s2 = s1.replace(rx, '2');
alert(s2);