#22843
Stefan
Participant

You have to add the zero’s padding yourself.
 

For example (a fix-two-digits result):


	redraw = false;
	if( document.selection.IsEmpty ) 
		{
			document.selection.StartOfDocument();
			var iCount = prompt("Type the Start Number please:", "1");
			var strFind = "^\\d+";
			while(document.selection.Replace(strFind, iCount, eeFindReplaceRegExp | eeFindNext))
				{
					iCount++; 
					iCount = ("0"+iCount).slice(-2); 
				}
		}

 
 
-or, more flexible (type in ‘1’, or ’01’, or ‘001’, or ‘0001’, …. to set the wanted amount of zeros:
 


	redraw = false;
	if( document.selection.IsEmpty ) 
		{
			document.selection.StartOfDocument();
			var iCount = prompt("Start Number (incl. leading zero(s):", "1");
			var iCountLen = iCount.toString().length;
			var strFind = "^\\d+";
			while(document.selection.Replace(strFind, iCount, eeFindReplaceRegExp | eeFindNext))
				{
					iCount++; 
					iCount = ("00000000"+iCount).slice(-iCountLen); 
				}
		}