<!-- Extract the version number from a file and put it in a property called version --> <!-- where you can use it to create filenames etc. --> <!-- Author John B. Matthews --> <loadfile srcfile="${my.path}/MyFile.java" property="version"> <filterchain> <linecontainsregexp> <!-- Find the line containing String VERSION = "xxx"; --> <regexp pattern='^.*String VERSION = ".*";.*$'/> </linecontainsregexp> <tokenfilter> <!-- Extract just the version number from the line --> <replaceregex replace='\1' pattern='^.*String VERSION = "(.*)";.*$'/> </tokenfilter> <striplinebreaks/> </filterchain> </loadfile>