JSFiddle - React, Tailwind, and code Playground JavaScript console.log( 'Abcde'.replace(/[\s\S]/g, (a,b,c)=>c[--c.length-b]) )