Login | Register
My pages Projects Community openCollabNet

Discussions > users > Re: Problem with named capture group in RegexReplace Task

msbuildtasks
Discussion topic

Back to topic list

Re: Problem with named capture group in RegexReplace Task

Author sshnug_si
Full name si
Date 2008-03-06 15:26:02 PST
Message As a followup, if I use an almost identical regex in the FileUpdate
task, the named capture group works fine in the ReplacementText
attribute value. So I was able to workaround my problem but not
completely resolve it. Here's the code that works:

<Target Name="BeforeBui​ld">
<ReadLinesFromFile File="..\Prope​rties\AssemblyInfo.​cs">
  <Output TaskParameter="Lines"
          ItemName="Produ​ctAssemblyInfo"​/>
</ReadLinesFromFile>
<RegexMatch Input="@(Produc​tAssemblyInfo)"​
            Expression="Ass​emblyVersion"​>
  <Output ItemName="Produ​ctAssemblyVersion​"
          TaskParameter="​Output" />
</RegexMatch>
<FileUpdate Files="Setup.wxs"
            Regex='define ProductVersion =
"[0-9][0-9]?[0-​9]?\.[0-9][0-9]?[0-​9]?\.[0-9][0-9]?[0-​9]?\.[0-9][0-9]?[0-​9]?"'
            ReplacementText='define ProductVersion = "@(ProductAssem​blyVersion)"​' />
<FileUpdate Files="Setup.wxs"
            Regex='\[assembly:
AssemblyVersion\(\​"(?&lt;vers​ion&gt;[0-9][0-9​]?[0-9]?\.[0-9][0-9​]?[0-9]?\.[0-9][0-9​]?[0-9]?\.[0-9][0-9​]?[0-9]?)\"\)​\]'
            ReplacementText=​"${version}" />
</Target>

--
It's a wild world that we live in, you step to the vibe like a new
found religion, take your position, compile your vision, futurism,
algorithm has risen up! pfm - the western

« Previous message in topic | 2 of 2 | Next message in topic »

Messages

Show all messages in topic

Problem with named capture group in RegexReplace Task sshnug_si si 2008-03-05 20:36:27 PST
     Re: Problem with named capture group in RegexReplace Task sshnug_si si 2008-03-06 15:26:02 PST
Messages per page: