using nodejs I am trying to generate an unique URL for user to conform email address. From that URL user will be able to verify th
However, .replace()
will only replace first occurrence.
To be more precise, you can use something like this :
// Original Text
var ciphertext = 'asda+dasd+asdas/asdasd/sadasdasd/dadasd=adsasda=dasd=';
// Replaced Text
var dataString = ciphertext.replace(/\+/g,'p1L2u3S').replace(/\//g,'s1L2a3S4h').replace(/=/g,'e1Q2u3A4l');
console.log(dataString);
// Back to Original Text
ciphertext = dataString.replace(/p1L2u3S/g, '+' ).replace(/s1L2a3S4h/g, '/').replace(/e1Q2u3A4l/g, '=');
console.log(ciphertext);