I would like to use a property instead of a hardcoded text in the "regexp" attributes of the "propertyregex" Ant contrib task.
How can I do it so that the property is substituted first rather than its text used as the regex itself?
Example:
var name="regexp" value="${placeholder.start}|${placeholder.end}" />
<propertyregex property="a" input="${a.raw}" regexp="${regexp}" replace="" global="true" override="true" />
You can use a <property>
to pass the regular expression to the regexp
attribute:
<property name="a.raw" value="~_one_~ two ~_three_~" />
<property name="placeholder.start" value="~_" />
<property name="placeholder.end" value="_~" />
<property name="regexp" value="${placeholder.start}|${placeholder.end}" />
<propertyregex
input="${a.raw}"
regexp="${regexp}"
replace=""
global="true"
property="a" />
<echo>${a}</echo>
[echo] one two three