You must also escape the \ character

<
replaceregexp 
file="${artifactsdir}/${label}/${env}/src/include/configuration_wassup.php"
match='define(\\"WS_WASSUPHOST\\" *, *\\".*\\");'                               
 
replace='define(\\"WS_WASSUPHOST\\", \\"${dev.bck.mmc.ws_wassuphost}\\");'
/>

-----Original Message-----
From: Krzysztof Kucybala [mailto:[EMAIL PROTECTED]
Sent: Friday, August 17, 2007 9:30 AM
To: user@ant.apache.org
Subject: How to escape characters in regexp strings?


Hi,

I have a problem. I'm trying to have ant substitute something in a few 
files. Here's the sample:

<
replaceregexp 
file="${artifactsdir}/${label}/${env}/src/include/configuration_wassup.php"
match='define("WS_WASSUPHOST" *, *".*");'                                
replace='define("WS_WASSUPHOST", "${dev.bck.mmc.ws_wassuphost}");'
/>

This does not give me any errors, but it doesn't do anything. When I 
tried the same with " instead of ' in the match and replace attributes, 
obviously I'd need to escape other occurrences of " in the text. How do 
I do that? \" doesn't work :o( I will appreciate any help.

Best regards,
Krzysztof Kucybała

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to