In this section, you will learn how to use SSIS Advanced File System Task to perform advanced search and replace using Regular expression.
Scenario: For example, you have the following content in a file. You like to search for URLs and replace dots inside URL with space.
1.5, http://www.website.com 2.3, http://www.website.com
Expected Result after search and replace
1.5, http www website com 2.3, http www website com
Here is how you can use Advanced File System Task.
Action: Search and replace string in a file
Search Mode: Regular expression
Find what: (https?)://(\w+).(\w+).(\w+)
Replace with: $1 $2 $3 $4
In the replace with we have used $1, $2... Basically, in a regular expression, you can capture groups. Each Parenthesis is the Regex pattern is indicated as one group. They are accessed in order (starting from 1).