Java Mailing List Archive

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

Home » Ant Users List »

RE : using RE with newline problem

Rebhan, Gilbert

2008-03-12


Author LoginPost Reply

/*
    <loadfile srcfile="file.txt" property="temp.param">
          <filterchain>
               <linecontains>
                    <contains value="key = "/>
               </linecontains>
               <tokenfilter>
                    <stringtokenizer delims="="/>
                    <replaceregex pattern="('{1})"
replace=""/>
                    <replaceregex pattern="('{1})"
replace=""/>
                    <replaceregex pattern="key" replace=""/>
                    <replaceregex
pattern="${line.separator}"
replac
e="" /><!-- newly added line to eliminate new line or CR -->
               </tokenfilter>
               <tokenfilter>
                    <replacestring from="=" to=""/>
               </tokenfilter>
               <trim/>
          </filterchain>
    </loadfile>

/*

use =

<loadfile srcfile="key_value.txt" property="temp.param">
<filterchain>
  <tokenfilter>
   <replaceregex pattern="^.+='?(\d|\w+)'?$" replace="\1"/>
  </tokenfilter>
  <striplinebreaks/>
</filterchain>
</loadfile>


but if you use striplinebreaks you get =

<echo>$${temp.param} == ${temp.param}</echo>

${temp.param} == valuevalue1value2

Is that really what you want ??


Regards,
Gilbert

---------------------------------------------------------------------
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.