ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew van Renen" <avanre...@hotmail.com>
Subject replaceregexp and backslashes
Date Thu, 05 Sep 2002 15:29:10 GMT
I want to use <replaceregexp> to update a configuration file in a standard 
'name=value' construct, where the value is a Windows path name, as in:

    DocumentName=D:\apps\foo\schema.xml

I further want to store the path name in a properties file (for obvious 
reasons)

It all works fine, except that it appears I have to octuply(= x 8) my 
backslashes for the entry in my properties file, and quadruply the 
backslashes in my build file.  So this:

build.properties:

    App_Root_Dir=D:\\\\\\\\apps\\\\\\\\foo

build.xml:

    <replaceregexp file="app.ini"
           match="DocumentName=.*"
           replace="DocumentName=${App_Root_Dir}\\\\schema.xml)"/>

works but is rather unwieldy.

I realise that part of it is the whole business of escapes in Java and XML, 
but is there perhaps a way to either:

a. escape the whole string in one go (eg \'${App_Root_Dir}\schema.xml', or

b. do a scan/replace on the string to multiply the \s before submitting it 
to regexp

Any ideas out there?


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message