You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by snenkov <sn...@yahoo.com> on 2007/06/13 00:01:03 UTC
ant regex
I am using
<pathconvert property="to.classpath" refid="from.classpath" >
<mapper>
<mapper type="regexp" from="(.*)bin(.*)" to="\1\2"/>
</mapper>
</pathconvert>
where
from.classpath is
"C:\temp\dp\util\bin;C:\temp\dp\util\stack"
\1
returns
C:\temp\dp\util\
but
\2
does not return anything.
I want to get back
"C:\temp\dp\util\;C:\temp\dp\util\stack"
Thanks
Stefan
--
View this message in context: http://www.nabble.com/ant-regex-tf3910621.html#a11088164
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: ant regex
Posted by Stepan Mishura <st...@gmail.com>.
The next works for me:
<project name="tmp" default="doit" basedir=".">
<target name="doit">
<path id="from.classpath">
<pathelement location="C:\temp\dp\util\bin"/>
<pathelement location="C:\temp\dp\util\stack"/>
</path>
<pathconvert property="to.classpath" refid="from.classpath" >
<filtermapper>
<replacestring from="\bin" to=""/>
</filtermapper>
</pathconvert>
<echo message="${to.classpath}"/>
</target>
</project>
$ ant
Buildfile: build.xml
doit:
[echo] C:\temp\dp\util;C:\temp\dp\util\stack
BUILD SUCCESSFUL
Total time: 0 seconds
Thanks,
Stepan.
On 6/13/07, snenkov <sn...@yahoo.com> wrote:
>
> I am using
>
> <pathconvert property="to.classpath" refid="from.classpath" >
> <mapper>
> <mapper type="regexp" from="(.*)bin(.*)" to="\1\2"/>
> </mapper>
> </pathconvert>
>
> where
>
> from.classpath is
>
> "C:\temp\dp\util\bin;C:\temp\dp\util\stack"
>
> \1
>
> returns
>
> C:\temp\dp\util\
>
> but
>
> \2
>
> does not return anything.
>
> I want to get back
>
> "C:\temp\dp\util\;C:\temp\dp\util\stack"
>
>
> Thanks
> Stefan
> --
> View this message in context: http://www.nabble.com/ant-regex-tf3910621.html#a11088164
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: ant regex
Posted by snenkov <sn...@yahoo.com>.
Hi Gilbert,
thank you for the example. It works for me as well. I will use propertyregex
in that case
Stefan
Rebhan, Gilbert wrote:
>
>
> Hi,
>
>
> -----Original Message-----
> From: snenkov [mailto:snenkov@yahoo.com]
> Sent: Wednesday, June 13, 2007 12:01 AM
> To: user@ant.apache.org
> Subject: ant regex
>
> /*
> I want to get back
>
> "C:\temp\dp\util\;C:\temp\dp\util\stack"
> */
>
> your regexp works for me with antcontrib <propertyregex>,
> using the default regexp engine from sun jdk1.4
>
> <project name="bla" default="main" basedir=".">
> <!-- Import AntContrib -->
> <taskdef resource="net/sf/antcontrib/antlib.xml" />
>
> <property name="teststring"
> value="C:\temp\dp\util\bin;C:\temp\dp\util\stack"/>
>
> <target name="depends">
>
> <propertyregex property="newstring"
> input="${teststring}"
> regexp="(.*)bin(.*)"
> replace="\1\2"
> casesensitive="false" />
> </target>
>
> <target name="main" depends="depends">
> <echo>$${newstring} == ${newstring}</echo>
> </target>
>
> </project>
>
>
> [echo] ${newstring} == C:\temp\dp\util\;C:\temp\dp\util\stack
>
>
> when using
> replace="\2"
>
> i get =
> [echo] ${newstring} == ;C:\temp\dp\util\stack
>
>
> Regards, Gilbert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/ant-regex-tf3910621.html#a11109055
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: ant regex
Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
Hi,
-----Original Message-----
From: snenkov [mailto:snenkov@yahoo.com]
Sent: Wednesday, June 13, 2007 12:01 AM
To: user@ant.apache.org
Subject: ant regex
/*
I want to get back
"C:\temp\dp\util\;C:\temp\dp\util\stack"
*/
your regexp works for me with antcontrib <propertyregex>,
using the default regexp engine from sun jdk1.4
<project name="bla" default="main" basedir=".">
<!-- Import AntContrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<property name="teststring"
value="C:\temp\dp\util\bin;C:\temp\dp\util\stack"/>
<target name="depends">
<propertyregex property="newstring"
input="${teststring}"
regexp="(.*)bin(.*)"
replace="\1\2"
casesensitive="false" />
</target>
<target name="main" depends="depends">
<echo>$${newstring} == ${newstring}</echo>
</target>
</project>
[echo] ${newstring} == C:\temp\dp\util\;C:\temp\dp\util\stack
when using
replace="\2"
i get =
[echo] ${newstring} == ;C:\temp\dp\util\stack
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org