Copy all the text from words that contains specific value

I have multiple word files and I want to copy all the texts that contain ‘$’ sign. Is it able to use UiPath to help with this process?

Hi @OUGHOOOO ,
Welcome to forum
Yes, You can use UiPath for this process
You can read each file, check file contain “$”
then copy it
regards,

Hi @Nguyen_Van_Luong1 ,

thank you for your reply. What if the file also has multiple text that contains “$” sign. Is it able to extract all the values as well>

UiPath can read word file then return String value all of text in this file
to get each value of text in here, we can find it by location or regex
In this case, file have many text contain “$”, UiPath can get all of them

@OUGHOOOO

Welcome to the community

First use word application scope and read the data of word into a string variable

Then use the below formula to get all words containing $ using regex

System.Text.RegularExpressions.Regex.Matches(str,"[^\s]*[\$][^\s]*")

The above to be used in assign and output would be of type enumerable of matches

Use a for loop and give the above formula or the variable as input

Inside loop currentItem.Value will give each value you need

Hope this helps

Cheers

Hello @OUGHOOOO

Yes, you can use UiPath to automate the process of copying text from multiple Word files that contain a ‘$’ sign

  • Drag and drop the “Word Application Scope” activity - Specify the Word file path as input.
  • Inside the “Word Application Scope,” drag and drop the “Read Text” activity.
  • After reading the text, use an “If” activity to check if the text contains a ‘$’ sign.
  • You can use an expression like text.Contains(“$”).
  • f the condition is true (i.e., if the text contains ‘$’), use the “Copy to Clipboard” activity to copy the text.
  • If you want to store the copied text for later use, you can create a variable to hold the text and assign the copied text to this variable.
  • Use a loop (e.g., a “For Each” loop) to iterate through multiple Word files in a folder.
  • Within the loop, repeat the above steps for each Word file.
  • You can choose to save the copied text to a file or perform further processing as needed within the loop.
  • After processing each Word file, it’s a good practice to close the Word application using the “Close Application” activity.

You can try this it will copy all the file path

it will Copy all the files the that contain ‘$’ sign in texts.

@OUGHOOOO

You can try this way also

str_InPut = Filepath

Single File to Copy>>>Use this

str = System.Text.RegularExpressions.Regex.Match(str_InPut,".*\$.*").Value

Multiple to copy

str = System.Text.RegularExpressions.Regex.Matches(str_InPut,".*\$.*")

@OUGHOOOO