Skip to content

knom/vsts-regex-tasks

Repository files navigation

RegexReplace Build/Release Task Version Visual Studio Marketplace Downloads GitHub License Build Status

A task for replacing REGULAR EXPRESSIONS in your files with variables and text in build and release pipelines.

Supported Platforms

  • Azure DevOps - Pipelines
  • Team Foundation Server 2015 Update 3 and higher (How to install extensions in TFS)
  • Only Windows - sorry, this is due to the lack of Powershell support of the underlying task FX platform :-(
  • Build Agents w. Powershell 3.0 or higher

Usage

1. Add the RegEx Find & Replace task to your build or release pipeline.

Extension Tasks

2. Configure the parameters

Screenshot

Parameters:

  • Search Paths to Input Files:
    • The search patterns to the files that should used in Find & Replace
    • New in v3: Supports multiple input lines and minimatching
  • Find RegEx:
    • The Regular Expression to FIND text

    • RegEx Groups (brackets) are used for the replace option

    • E.g. find all XML/HTML comments

          <!-- (.*) -->
      
  • Replace With:
    • The text to replace with

    • $1 is the first group, $2 the second, ...

    • E.g. replace them with what was within the comment (comment it IN)

          $1
      
  • New in v3: UseRAW (default true):
    • Whether to use RAW file read mode (might help with replace issues, such as newline)
  • New in v3: UseUTF8 (default true):
    • Whether to read the file in UTF8 (otherwise in ASCII)

License

Now published under MIT License.