Search and Replace content in a text file

Use this step to "search and replace" text in a new file.

Last published at: September 5th, 2025

searchAndReplaceFile Step

Description:

The Search Replace File workflow step searches the contents of an input file for configured search-and-replace mappings and writes the resulting content to the specified output file.

The step supports:

  • Searching text within a file.
  • Defining mappings of search and replacement strings.
  • Processing a source file specified by a file path.
  • Writing the processed content to a specified output file.
  • Using multiple search-and-replace mappings.
  • Reusing the resulting file in subsequent workflow steps.
  • File-content transformation within workflow automation.
  • Returning a True or False result for subsequent workflow processing.

The step is defined in the Development category with the internal name searchandreplacefile, label “Search and replace file contents”, and display name “Search replace in File.” It is implemented by FlowWright.Workflow.Searchandreplacefile in FlowWright.Workflow.dll and is defined as a Process step with two incoming and two outgoing connections.

 

Inputs

  • inputFilePath – Specifies the path of the source file whose contents are to be searched and replaced.
  • outputFilePath – Specifies the path where the processed file is to be written.
  • mappingString – Defines the search-and-replace mappings that the step uses when processing the input file.
 

 

Outputs

  • True – The True return path can be connected to the next workflow activity after the file search-and-replace operation succeeds.
  • False – The False return path can be used for error handling or an alternative workflow path if the operation fails.
 

 

Usage:

The Search Replace File step is typically placed after a file has been created, generated, retrieved, or otherwise made available within a workflow.

The input file contains the text that needs to be processed. The configured search-and-replace mappings are then applied, and the resulting file is written to the specified output path.

A typical workflow pattern is:

Get/Create File → Search Replace File → Use Output File

The resulting file can then be used by later workflow steps to:

  • Store the processed file.
  • Send the file by email.
  • Generate or prepare documents.
  • Submit the file to another system.
  • Perform additional file processing.
  • Archive the processed file.
  • Provide the file as workflow output.
  • Continue an integration workflow.

The Search Replace String documentation follows a similar pattern for text processing: obtain or build content, perform the replacement, and pass the result to another activity.

 

Typical Workflow Suggestions:

Replace Template Placeholders

Use the step to replace placeholders in a reusable file template.

Example:

Create Template File → Search Replace File → Send File

Input file:

Dear {{CustomerName}},

Your request {{RequestID}} has been approved.

Thank you.
Mappings:
{{CustomerName}} → Acme Corporation
{{RequestID}} → REQ-1045
The processed file can then be sent or stored as the completed file.

The Search Replace String documentation demonstrates the same placeholder-based pattern for generated text, including mappings such as {{CustomerName}} and {{RequestID}}.

 

Prepare a Document Template

Use Search Replace File to populate a reusable file with workflow-specific information before the file is delivered to a user.

Example:

Get Customer Data → Search Replace File → Send Document

Template:

Customer: {{Name}}
Order Number: {{OrderNumber}}
Status: {{Status}}
This allows the same template to be reused across multiple workflow instances.
 

Generate Customer-Specific Files

Use the step to replace customer information in a standard file.

Example:

Retrieve Customer Data → Search Replace File → Save Customer File

Mappings can populate customer-specific values before the processed file is stored.

 

Prepare Files for Email

Use Search Replace File before an email step when an attachment needs to contain workflow-specific information.

Example:

Create File → Search Replace File → Send Email

The processed output file can be supplied to the subsequent email activity.

 

Generate Notifications or Reports as Files

Use a reusable report or notification template and replace its placeholders with values collected during workflow execution.

Example:

Collect Results → Search Replace File → Save/Send Report

Template:

Daily Processing Report

Processed: {{ProcessedCount}}
Successful: {{SuccessCount}}
Failed: {{FailureCount}}
The Search Replace String reference documentation illustrates this same template-population approach for text-based workflow reports.
 

Replace Multiple Values

A single mapping configuration can contain multiple search-and-replace pairs.

For example:

{{Customer}} → Acme Corporation
{{Region}} → North
{{Priority}} → High
{{Status}} → Approved
This is particularly useful when several pieces of information need to be populated in the same file.

The enterSearchReplaceString The data type used by this step is the same mapping type documented for Search Replace String, in which multiple search-and-replace rows can be added.

 

Prepare a File for Another Workflow Step

Use Search Replace File as an intermediate file-processing activity.

Example:

Retrieve Source File → Search Replace File → Additional File Processing

The step can prepare the file before it is passed to another workflow activity.

 

Prepare Integration Files

Use the step when an external integration requires a file containing workflow-specific values.

Example:

Retrieve Template → Search Replace File → External Integration

The processed output file can then be supplied to the integration activity.

 

Create Standardized Files

Maintain a common file template and dynamically replace selected values for each workflow instance.

For example:

Ticket {{TicketNumber}} has been assigned to
{{AssignedUser}}.

Priority: {{Priority}}
The same template can be reused for many workflow instances.

The Search Replace String documentation recommends consistent placeholder naming such as {{CustomerName}}, {{OrderNumber}}, and {{Status}} for reusable templates.

 

Normalize File Content Before Processing

Use Search Replace File before another file-processing activity when known strings need to be replaced or standardized.

Example:

Get Source File → Search Replace File → File Processing

This provides a dedicated transformation stage before the file reaches the next workflow activity.

 

Preserve the Original File

Specify a different output path when the original source file needs to remain unchanged.

Example:

Original File → Search Replace File → Processed Copy

The input file remains the source while the processed content is written to the configured output location.

 

Example:

Let’s build and execute the “searchAndReplaceFileDef” example.          

  • Create a new definition called “searchAndReplaceFileDef” and open the definition in designer mode.
  • Drag a “searchAndReplaceFile” step to the canvas. 
  • Connect the dots between the “Start” and “searchAndReplaceFile” steps, as shown above.  
  • Select the line between the steps to configure the “Connection Properties”. The default property values are “None, True, False, Error, and Evaluate”. Depending on the step’s purpose, additional values are available for configuration.
  • Click the “searchAndReplaceFile” step to configure its “Required” properties. Provide a name for the step. Provide a file patch for the input source. Provide a file path to store the output. Click the button to map the search and replace strings. Click the Save button. Note: Click the "AI Predict" button to have the Copilot add new process steps that match your process description. 

 

  • Click the button to map the search and replace strings. A pop-up window appears for configuration. Click the Add Row button to insert an empty row. Enter the “search” and “replace” string values. Click the Save button. You may add multiple string values by using the Add Row button. 

 

  • The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

 

  • Save the process definition, create a new instance, and execute it. Render the process instance. Click the process step to view its properties. When the workflow reaches the Search Replace File step, the workflow supplies the configured input file path, output file path, and search-and-replace mappings. The step processes the input file and provides its True or False return path.

 

Tips:

  • Keep search strings specific enough to avoid unintended replacements.
  • Use consistent placeholder naming in reusable file templates.
  • Use meaningful placeholder names such as {{CustomerName}}, {{OrderNumber}}, and {{Status}}.
  • Keep replacement mappings organized when multiple values are being replaced.
  • Test the mapping with representative input files before deploying the workflow.
  • Verify that every expected placeholder has an appropriate replacement value.
  • Check the input file for unexpected or missing values before the step executes.
  • Use meaningful, maintainable file paths for both input and output files.
  • Verify that the output file is available at the expected location before using it in a downstream activity.
  • Consider connecting the False return path to appropriate error handling.
  • Reuse standardized file templates when the same file type is generated repeatedly.
  • Test mappings against realistic files containing repeated occurrences of the same search value.
  • Test the workflow after changing a template or its replacement mappings.
  • When processing user-supplied files, test unexpected characters and formatting.
  • Do not assume matching behavior such as case sensitivity, regular-expression support, or replacement ordering unless confirmed by the FlowWright implementation.
  • Keep replacement mappings maintainable when templates evolve.
  • Verify that the output path does not unintentionally overwrite an important source file.
  • Keep sensitive information out of generated files when the output will subsequently be exposed to users or external systems.

 

Notes:

  • The Search Replace File step is defined in the Development category with the internal name searchandreplacefile, label “Search and replace file contents”, and display name “Search replace in File.”
  • The step is implemented by FlowWright.Workflow.Searchandreplacefile in FlowWright.Workflow.dll and is defined as a Process step with two incoming and two outgoing connections.
  • The step defines three required properties:
    • inputFilePath – Input file path to be searched and replaced.
    • outputFilePath – Output file path.
    • mappingString – Mapping of search and replace strings. 
  • The first two properties use the string data type, implemented by FlowWright.DataTypes.ClsTextBox
  • The mapping property uses the enterSearchReplaceString data type, implemented by FlowWright.DataTypes.ClsEnterSearchReplaceString.

 

Feature Comparison:

Feature SearchAndReplaceString SearchAndReplaceFile
Purpose Search and replace text within a string Search and replace text within a file
Category Development Development
Internal Name searchandreplacestring searchandreplacefile
Display Name Search Replace String Search replace in File
Label Search and replace the string Search and replace file contents
Implementation FlowWright.Workflow.Searchandreplacestring FlowWright.Workflow.Searchandreplacefile
DLL FlowWright.Workflow.dll FlowWright.Workflow.dll
Step Type Process Process
Incoming Connections 2 2
Outgoing Connections 2 2
Number of Inputs 3 3
Input 1 Input string to be search and replace Input file path to be search and replace
Input 2 Mapping of search and replace strings Output file path
Input 3 Variable/Global to store the search and replace string Mapping of search and replace strings
Input 1 Type multilineTextBox string
Input 2 Type enterSearchReplaceString string
Input 3 Type string enterSearchReplaceString
All Inputs Required? Yes Yes
Result Destination Variable/Global Output file
Return Paths True / False True / False

 

Definition Sample:

You may download the sample definition(s) from the link provided and later import them into your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.

Note: Verify and complete any missing configuration after importing the sample, including:

  • Input file path.
  • Output file path.
  • Search-and-replace mappings.
  • Workflow Variable references, where applicable.
  • Environment-specific file locations.
  • Downstream True and False workflow paths.

After verifying the configuration, save the Process Definition before execution.

Click here to download the sample file.