Hi Jacob

 

try this 

${target.dir}/foobar.xml contents contains some well known regular expression 
match criteria as in space between E: foo and bar:

Property=E: foo bar

 

  <replaceregexp match="\s+" replace="/" flags="g" byline="true" 
file="${src}/build.properties">
  </replaceregexp>


the ${target.dir}/foobar.xml replaceregexp transforms whitespace character to /:
Property=E:/foo/bar

 

hth
Martin 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité


 
Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy 
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése 
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi 
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen 
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet 
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.



 

> From: jakob....@gmail.com
> Date: Tue, 11 May 2010 11:19:33 +0200
> Subject: backslash escaping in a regex
> To: user@ant.apache.org
> 
> Hi, looked through the archive, but I don't think pathconvert can be
> used in this case.
> 
> property file:
> prop=E:\\foo\\bar
> 
> build file:
> <replaceregexp file="${target.dir}/foobar.xml">
> <regexp pattern="value=&quot;[^&quot;]+&quot;"/>
> <substitution expression="value=&quot;${prop}&quot;"/>
> </replaceregexp>
> 
> actual result:
> value="E:foobar"
> 
> desired result:
> value="E:\foo\bar"
> 
> I also tried double escaping i.e.
> prop=E:\\\\foo\\\\bar
> 
> but there all backslashes disappear as well.
> 
> 
> thanks for pointers,
> Jakob.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
> 
                                          
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

Reply via email to