AnsweredAssumed Answered

generic "replace" (Format) script

Question asked by doronzaccai433811 on Jan 9, 2017
Latest reply on Jan 10, 2017 by doronzaccai433811

Hi All, 


The below java script is working. 



mask1 = /^([\A-Z,a-z,0-9]{2})([\A-Z,a-z,0-9]{2})([\A-Z,a-z,0-9]{2})([\A-Z,a-z,0-9]{2})([\A-Z,a-z,0-9]{1}).*/;

mask2 = '$1-$2-$3-$4-$5';

convertedNatId = '';

if (mask1) {

convertedNatId = Id.replace(mask1,mask2);

} else {

convertedNatId = Id;


alert(convertedNatId); it gives AA-AA-AA-AA-A


When I put mask1 and 2 in a reference table as text constants and retrieve in the map function, the mask2 "replace" works. But the mask1 does not. 


if anyone has a solution - please let me know.


Thank you.