Word - replace text

Hi all,

I have this sentence to be replaced in a word document.

“Created at 24/01/2019 in Brussels.”

I need to iterate it for a lot of documents, and the date varies for all the documents.

It should be replaced by “Created at in Brussels.”

Extra clarification: the date is at the bottom of the page and the document can be 10 pages, 15 pages,… I’m looking for something like replace text: “Created at ??/??/??? in Brussels” by “Created at in Brussels.”

Thanks in advance,
Kind regards

Hi @yannip,
Use word application scope activity to open word document and inside that scope use replace text activity to replace the text.
I have attached the workflow for your reference.solution2.zip (20.0 KB)

Hope this helps!


Hi @yannip,

If want to replace all dates in the documents, you can use regex.
1.Read the word documents to a string.
2. Assign your_string= System.Text.RegularExpressions.Regex.Replace(your_string,"(\d{1,2}/\d{1,2}/\d{4})","")
If you want to replace only the dates after the string “Created at”,
assign your_string= System.Text.RegularExpressions.Regex.Replace(your_string,"(?<=Created at\s)\d{1,2}/\d{1,2}/\d{4}","")

Warm regards,

Thanks for your reply but this will not work.
As said, a bot will be doing this subcode for more than 100 word documents.
Sometimes he has to replace “Created at 24/01/2019 in Brussels”, sometimes “Created at 25/01/2019 in Brussels”. As you can see, the date is variable.

Hi nimin,

Thanks for your suggestion. However I’m afraid this solution is not that good as I am doing other activities as well and I’m afraid of losing the existing layout when doing it this way.

Hi @yannip,

This will only find and replace any dates after “Created at” with null. I don’t think the existing layout will change.:slightly_smiling_face:


Hi @yannip

Have you tried using activity replace?

PATTERN: “(?<=Created\sat\s)\d\d/\d\d”


In this example above:

  • original text: Created at 24/01/2019 in Brussels.
  • Result: Created at in Brussels

Note: will work for any date.