Help with string.replaceMultiple to replace substrings in bulk

I want to rename my sheets in bulk. Here is my script’s string replace setup:


All lists equal length and chopped.

I want to take prefixes that range from 1111-2222…-nnnn and replace them with generated names in the bottom list. The output seams right but it’s trying to rename 1111 prefix twice instead of doing first 10 names for 1111 next 10 names for 2222.

How do I set it up so that it looks for all the given prefixes (searchFor) and just matches 1st string with first replacement, 2nd with 2nd and so on. The lists are sorted properly so it should just match them 1 to 1, 2 to 2. I guess something’s wrong with levels or lacing but I don’t know what.

HI @1bitBoolean ,

Structure your inputs like this:

In your case you probably only have to add an List.FirstItem after the List.Chop to get the inputs you need.

2 Likes

So no chopping just sorted equal length lists, no lacing or levels?

Oh, I apologize didn’t notice that the bottom list is now only 2 elements


It is replacing strings correctly it seams now I need to figure out levels and lacing for set parameter. Because it’s not renaming half of the sheets. Message pops up saying I have duplicate name values.

If you want these values to be your Sheet Names, shouldn’t you write to the Sheet Name parameter instead of the Sheet Number?

Project specifics - we use sheet numbers to identify sheets instead of sheet names. I don’t know why but yeah I have to change number not name.

How do I make it rename properly in setparametername node? Because string.replace is now outputing correct output so it’s ready for renumber.

I found solution - just used sheet.renumberRename node. Thanks much for helping with string.replace!

1 Like