Replace the word in document by number given by user with +1 increment

Hi All,
I have a one doc file which has multiple which has many word similar like “Index000” and for example in the file this word has 10 time so I want replace this word “Index000” to “Index009”
and in input field I want user can mention that how many he want replacement
if I mention 6 it can only replace word 6 times like “index000” to “index005”
and remaining 4 word will remain the same

Hi @Pramod_Sharma,
I think you should show an example of this with detailed description so people will understand it more.

Hi @Pramod_Sharma,

Maybe this can help you.

outtext = System.Text.RegularExpressions.Regex.Replace(text,
"index000", Function(m As Match)
    idx += 1
    Return If(idx <= in_numTimes, String.Format("index{0}", idx.ToString), "index000")
End Function, RegexOptions.CultureInvariant)

Use it inside a invoke code activity.

image

If it helps, please mark as solution.

Cheers.

1 Like