ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amarjit Jutla" <amarj...@xeye.com>
Subject RE: How to escape characters in regexp strings?
Date Fri, 17 Aug 2007 13:34:19 GMT
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:kkucybala@echo.fr]
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

Mime
View raw message