Solved

Msbuild with Regex

Posted on 2011-09-02
1
1,087 Views
Last Modified: 2013-11-26
I am trying to write a target that looks at a svn_tag and sees if that includes the word -dev. I have done like below but I only get the output like this:

Regex:
12:40:44    Input : Build-1.0.0.154 Output :



 <Target Name="Regex">  
  <PropertyGroup>
  <Out>$([System.Text.RegularExpressions.Regex]::Match($(SVN_TAG), `-dev`))</Out>  
  </PropertyGroup>    
  <Message Text="Input : $(SVN_TAG) Output : $(Out)"/>  
 </Target>


How can I do this? Just need true or false answer.
0
Comment
Question by:Mickeys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 500 total points
ID: 36472736
Change your line
<Out>$([System.Text.RegularExpressions.Regex]::Match($(SVN_TAG), `-dev`))</Out>

For this one:
<Out>$([System.Text.RegularExpressions.Regex]::Match($(SVN_TAG), `-dev`).Success.ToString())</Out>

Hope that helps.
0

Featured Post

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question