regex - MSBuild Community Taks RegexReplace remove trailing slash from path -


i trying use msbuild community tasks remove slash end of outputpath

this have far.

<regexreplace input="$(outputpath)" expression="\$" replacement="" count="1">  <output itemname="formattedoutputpath" taskparameter="output" /> </regexreplace> <message text="@(formattedoutputpath)"/> 

unfortunately message returns path still slash on end. path c:\mydirectory\

it looks expression incorrect

can help?

slash using escape character, in pattern have escape slash character slash:

<regexreplace input="$(outputpath)" expression="\\$" replacement="" count="1">   <output itemname="formattedoutputpath" taskparameter="output" /> </regexreplace> <message text="@(formattedoutputpath)"/> 

to better understand escaping see following examples:

  1. $ represents end of line/string
  2. \$ represents dollar sign character
  3. \\ represents slash character
  4. \\$ represents slash character @ end of line/string

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -