Using Wildcard in Replace Text in Document

Hi All,

I am trying to use replace text in document from word activates which contains wildcard in the text to be found. But it doesn’t seem to work. it is there a way to do that?

Objective: I need to replace a text in multiple files but the text is different in them. The common thing in this text is that it starts with 3000 following by 7 random numbers. (ex. 30001234567).
So, I tried to replace text using wildcard 3000???.

Hey @1990mustafa

The activity you are trying to use here please ?

Thanks
#nK

You can use Regex.Replace to archieve your goal:

image

Invoke this into an assign activity:

System.Text.RegularExpressions.Regex.Replace(var_string,"3000\d{7}","ThisIsTheReplacement")

image

This will replace any combination of “3000” + “7 digits” to whatever you want.

Edit: Adding image of the assign as reference:
image

Apologies, just saw it’s tagged as StudioX, anyway, you can do exactly the same, changing “Assign” activities for “Set variable Value” activity:

2nd Set Variable Value should be of type “Open in Advanced Editor”

image

For reference:

Edit: Attaching version to work with Word files.
ReplaceWord.zip (134.7 KB)

thank you for your help

1 Like

Happy to help!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.