RegexMatch Class

MSBuild

Task to filter an Input list with a Regex expression. Output list contains items from Input list that matched given expression


Namespace: MSBuild.Community.Tasks
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)

Syntax

Visual Basic (Declaration)
Public Class RegexMatch
    Inherits RegexBase
C#
public class RegexMatch : RegexBase
C++
ref class RegexMatch : RegexBase
J#
public class RegexMatch extends RegexBase
JScript
public class RegexMatch extends RegexBase

Example

Matches from TestGroup those names ending in a, b or c

 Copy Code
            <ItemGroup>
               <TestGroup Include="foo.my.foo.foo.test.o" />
               <TestGroup Include="foo.my.faa.foo.test.a" />
               <TestGroup Include="foo.my.fbb.foo.test.b" />
               <TestGroup Include="foo.my.fcc.foo.test.c" />
               <TestGroup Include="foo.my.fdd.foo.test.d" />
               <TestGroup Include="foo.my.fee.foo.test.e" />
               <TestGroup Include="foo.my.fff.foo.test.f" />
            </ItemGroup>
            <Target Name="Test">
               <!-- Outputs only items that end with a, b or c -->
               <RegexMatch Input="@(TestGroup)" Expression="[a-c]$">
                  <Output ItemName ="MatchReturn" TaskParameter="Output" />
               </RegexMatch>
               <Message Text="&#xA;Output Match:&#xA;@(MatchReturn, '&#xA;')" />
            </Target>
            

Inheritance Hierarchy

System.Object
   Microsoft.Build.Utilities.Task
      MSBuild.Community.Tasks.RegexBase
         MSBuild.Community.Tasks.RegexMatch

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also

Syntax based on .NET Framework version 2.0.
Documentation version 1.0.0.0.