Andrew van Renen
2002-09-05 15:29:10 UTC
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
'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