You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rebhan, Gilbert" <Gi...@huk-coburg.de> on 2008/03/12 08:58:03 UTC

RE : using RE with newline problem

/*
        <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@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org