Page 1 of 1

Search and Replace multiple characters

Posted: Tue Aug 21, 2018 12:22 pm
by Support_Alisa
Question:

How do I search for and replace multiple characters and strings?

Answer:

The "Search and Replace" task can be a great tool for updating and reformatting files, fixing misspellings, and filtering out unwanted special characters.

The "Search and Replace" task takes an input file and parses the file, searching for the string inputted in the "Search For" field. "Search and Replace" treats the value in the "Search For" field as a single string value.

For example -

Inputting € â into the "Search For" field would search for '€ â'. Search and replace would not do one search for €, followed by another search for â. If you are wanting to search for these two characters separately, you have to leverage two different "Search and Replace" tasks. You would create one "Search and Replace" task for € followed by another "Search and Replace" task for â. In this instance, the input file of the subsequent "Search and Replace" task, will be the output file of the task preceding it. A walk through example of how to create a multitask "Search and Replace" project can be referenced below:

For convenience, set a variable that is equivalent to the directory path you want to be working in.
screenshot1.png
screenshot1.png (20.38 KiB) Viewed 8650 times
Select your "Input File," "Output File," and "Output Files Variable." The "Output Files Variable" will be used as your "Input File" for the next task.
screenshot2.png
"Input File" now contains the file ${dir}/output that has â replaced.
screensho3.png
After running this project, you will have two output files. The first "output" file that has only the â replaced, and output2 which has the final, fully parsed and updated file. If you would like to remove the intermediary output file, you can add a "Delete" task to delete ${currentFile}. This will leave your directory with only the original file and the final output file.