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 2006/02/02 16:00:32 UTC
replace < with < in property ??
Hi,
Problem =
i have a property like that :
<bla>foobar</bla>
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("<", "<");
three=two.replace(">", ">");
project.setProperty("foobar", three);
]]></script>
doesn't work either, gives me =
org.mozilla.javascript.EvaluatorException: Cannot convert < to
java.lang.Character
Any ideas ??
bye4now, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replace < with < in property ??
Posted by Sujeet Banerjee <su...@persistent.co.in>.
Hello Gilbert
The attribute "regexp" represents the regular expression which is matched in the input string. You
are trying to match a pattern that's a part of the input string. I'd suggest using perl (can be
executed both in Linux/Win-x platforms)
-Sujeet
----- Original Message -----
From: Rebhan, Gilbert
To: user@ant.apache.org
Sent: Thursday, February 02, 2006 8:30 PM
Subject: replace < with < in property ??
Hi,
Problem =
i have a property like that :
<bla>foobar</bla>
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("<", "<");
three=two.replace(">", ">");
project.setProperty("foobar", three);
]]></script>
doesn't work either, gives me =
org.mozilla.javascript.EvaluatorException: Cannot convert < to
java.lang.Character
Any ideas ??
bye4now, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replace < with < in property ??
Posted by Gilbert Rebhan <an...@schillbaer.de>.
Hi,
thanks for your suggestions :
> Remember that in XML < is turned into < before ant sees it, so you
> need to escape the search and replace
> strings:
>
>
> <propertyregex property="foobar"
> input="${auftrag.bemerkung}"
> regexp="&lt;"
> replace="<"
> casesensitive="false" />
but :
<property name="foobar" value="<bla>foobar</bla>" />
<echo>${foobar}</echo>
<propertyregex property="foo"
input="${foobar}"
regexp="&lt;"
replace="<"
casesensitive="false" />
<echo>${foo}</echo>
just gives me :
[echo] <bla>foobar</bla>
[echo] ${foo}
hm, let's see the other way around :
<echo file="J:/test/test.txt">fixed=${foobar}</echo>
yup, the property is written as :
fixed=<bla>foobar</bla>
but doesn't work either, when loading the propertyfile afterwards,
property ${fixed} get's not expanded --> ${fixed}
Even after manuelly changing the propertyfile to :
fixed=<bla>foobar</bla>
it does not get expanded.
Any other ideas ?!?
by4now, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: replace < with < in property ??
Posted by Steve Loughran <st...@hpl.hp.com>.
Rebhan, Gilbert wrote:
> Hi,
>
> Problem =
>
> i have a property like that :
>
> <bla>foobar</bla>
>
> 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.
no, obviously not.
Remember that in XML < is turned into < before ant sees it, so you
need to escape the search and replace
strings:
<propertyregex property="foobar"
input="${auftrag.bemerkung}"
regexp="&lt;"
replace="<"
casesensitive="false" />
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org