Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
containsregex and concat

containsregex and concat

2006-11-26       - By George Bills
Reply:     1     2     3     4     5     6     7     8     9     10  

I've been trying to use a regular expression and the concat task to pull
summary tables (<table class="summary">...</table>) out of a set of test
reports. The reports are all HTML files sitting in ${report.path}. The
task works fine up until I start trying to select output from it with
<containsregex>. Is there something wrong with my regular expression? Is
there an easier way to do this? Any help would be appreciated.

The code is:
====================
<target name="summary"> <!-- make a report summary -->
   <property name="summary.start" value="&lt;table
class=&quot;summary&quot;&gt;" />
   <property name="summary.body"  value=".*?" /> <!-- enable "s" for
newline matches -->
   <property name="summary.end"   value="&lt;/table&gt;" />
   <property name="summary.regex"
value="${summary.start}${summary.body}${summary.end}" />
   <echo>${summary.regex}</echo>
   <concat>
       <header>HEADER</header>
       <fileset dir="${report.path}"
           includes="*.html"
           excludes="${summary.file}" />
           <filterchain>
               <tokenfilter>
                   <filetokenizer />
                   <containsregex flags="is"
                                  pattern="${summary.regex}" />
               </tokenfilter>
           </filterchain>
       <footer>FOOTER</footer>
   </concat>
</target>
====================

The regular expression echoes as:
====================
<table class="summary">.*?</table>
====================

I've done some testing of the expression at
http://www.fileformat.info/tool/regex.htm, and it seems to work there.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.