Your solution with regex is nearly correct, but you have to escape < and >
;-)

The below snippet was successful tested :-)
        <target name="test" >
                <property name="input"
value="&amp;lt;bla&amp;gt;foobar&amp;lt;/bla&amp;gt;" />
                
                <echo message="Input: '${input}'" level="info" />
                <propertyregex property="output"
                                          input="${input}"
                                          regexp="&amp;lt;"
                                          replace="&lt;"
                                          casesensitive="false" />
                <echo message="Output: '${output}'" level="info" />
                <propertyregex property="output"
                                          input="${output}"
                                          regexp="&amp;gt;"
                                          replace="&gt;"
                                          casesensitive="false"
override="true" />
                <echo message="Output: '${output}'" level="info" />
        </target>

test:
     [echo] Input: '&lt;bla&gt;foobar&lt;/bla&gt;'
     [echo] Output: '<bla&gt;foobar</bla&gt;'
     [echo] Output: '<bla>foobar</bla>'

Maybe you can combine it in one statement ...

Klaus 

> -----Original Message-----
> From: Rebhan, Gilbert [mailto:[EMAIL PROTECTED] 
> Sent: 02 February, 2006 16:01
> To: user@ant.apache.org
> Subject: replace &lt; with < in property ??
> 
> 
> Hi,
> 
> Problem =
> 
> i have a property like that :
> 
> &lt;bla&gt;foobar&lt;/bla&gt;
> 
> and i want it to convert to =
> 
> <bla>foobar</bla> before putting in
> in a mailbody
> 
> i've tried =
> 
> <propertyregex property="foobar"
>                   input="${auftrag.bemerkung}"
>                   regexp="lt;"
>                   replace="<"
>                   casesensitive="false" />
> 
> but that is not accepted.
> 
> i've tried with javascript =
> 
> <script language="javascript"><![CDATA[           
>         one=project.getProperty("foobar");
>         two=one.replace("&lt;", "<");
>         three=two.replace("&gt;", ">");                 
>        project.setProperty("foobar", three);
>   ]]></script>
> 
> doesn't work either, gives me =
> 
> org.mozilla.javascript.EvaluatorException: Cannot convert 
> &lt; to java.lang.Character
> 
> 
> Any ideas ??
> 
> bye4now, Gilbert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] For 
> additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to