If you just want to know if a substring exists in a string, you can use the <contains>
task along with the <if>
task from ant -contrib . If you want to scan a pattern (regular expression) in a string, use <matches>
instead of <contains>
.
Check out the examples on this page: Ant Manual: Condition Tasks
In addition, an example:
<if> <contains string="a sample string" substring="sample" /> <then> <echo>match</echo> </then> <else> <echo>not match</echo> </else> </if>
coolcfan
source share