Thats регулярное выражение, не строка. Используйте конструктора для Объекта RegExp для динамичного создания regex.
var r = new RegExp(stringToFind, 'g');
mystring.replace(r, 'some replacement text');
Based on the issue you have to patch ant or used javascript:
<target name="test">
<script language="javascript">
project.setNewProperty("current_target", self.getOwningTarget());
</script>
<echo>${current_target}</echo>
</target>
I think you can't, unless you spend some time coding your own custom tasks (http://ant.apache.org/manual/tutorial-writing-tasks.html)
The built-in properties you can display are: basedir, ant.file, ant.version, ant.project.name, ant.java.version