escaping a dollar in the middle of an ant property

Posted by jk on Stack Overflow See other posts from Stack Overflow or by jk
Published on 2010-04-13T15:57:43Z Indexed on 2010/04/13 16:13 UTC
Read the original article Hit count: 299

Filed under:
|
|

I have a property whose value contains a $. I'd like to use this property as a regexp in a propertyregexp. Ant appears to resolve the property as a paramater to the propertyregexp, but then the dollar gets interpreted as a regexp symbol.

Example:

<property name="a" value="abc$" />
<property name="b" value="xyz" />
<path id="paths">
  <pathelement location="abc$/def" />
  <pathelement location="abc$/ghi" />
</path>
<pathconvert property="list" refid="paths" pathsep="${line.separator}" dirsep="/" />
<propertyregex property="list" input="${list}" override="true" regexp="${a}(.*)" replace="${b}\1" />
<echo message="${list}" />

I'd like to the pair xyz/def and xyz/ghi. Is this possible? I'm using Ant 1.8.

© Stack Overflow or respective owner

Related posts about ant

Related posts about java