Visual Studio Team Services Task to replace file content with a regex match
Visual Studio Team Services Task to replace file content with a regular expression match.
Using RegEx Match & Replace Task
Follow the instructions given below to add and configure RegEx Match & Replace Task in your build/release pipeline.
Add the RegEx Match & Replace Task
Install the RegEx Match & Replace Task in to your Visual Studio Team Services account and search for the task in the available tasks. The task will appear in the Utility section of the task list. Add it to your build/release task.
RegEx Match & Replace Task has some required configuration options that needed to be provided. The required configuration options are;
Path to File
Regular Expression to use
These configurations are found in the RegEx Match & Replace section.
Path to File : (Required) Select the file to run the Regular Expression search.
Regular Expression to use : (Required) Enter the regular expression without the modifiers. (Eg. (?:\d*.)?\d+) Learn more about Regular Expressions from Microsoft RegEx Quick Reference and test your Regular Expressions online using RegExr
Global Match (g) : (Optional) Perform a global match. Find all matches rather than stopping after the first match.
Ignore Case (i) : (Optional) Select the file to run the Regular Expression searchPerform case-insensitive matching.
Multi Line (m) : (Optional) Perform multi-line matching..
Replacement value : (Required) Enter the value to replace with the regex match.