You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Derricutt <ma...@talios.com> on 2002/03/04 22:22:54 UTC

String translation/regex

I have a property thats set to "5.0.019" for a version number, but cvs tags 
don't allow .'s, is there a way to do a regex and change all the .'s to _'s 
from ant?

                                   -- \m/ --
  "...if I seem super human I have been misunderstood." (c) Dream Theater
          mark@talios.com - ICQ: 1934853 JID: talios@myjabber.net

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: String translation/regex

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
This is actually one of the better uses of <script> around.  Again, to
clarify - I dislike <script> when its used to solve a problem that should be
solved in some more elegant way.  Replacing and "_" with a ".", besides
<replaceregexp> (which isn't available in a released version yet) is
perfectly cool with me.

Also, post 1.4.1 release a modification was made to <script> so that
"project" can be used instead of "<project name>".  It makes having
re-usable script blocks among build files with different project names
possible.  (And I am responsible for that change, thank you very much!)

    Erik


----- Original Message -----
From: "Diane Holt" <ho...@yahoo.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Monday, March 04, 2002 5:06 PM
Subject: Re: String translation/regex


> --- Mark Derricutt <ma...@talios.com> wrote:
> > I have a property thats set to "5.0.019" for a version number, but cvs
> > tags don't allow .'s, is there a way to do a regex and change all
> > the .'s to _'s  from ant?
>
> Or if you don't want to deal with reading and writing a file (and want to
> see Erik cringe :) --
>
>   <property name="version" value="5.0.019"/>
>
>   <target name="setTag">
>   <script language="javascript"> <![CDATA[
>     cvstag = projname.getProperty("version").replace('.', '_');
>     projname.setProperty("cvstag", cvstag);
>     ]]></script>
>     <echo message="cvstag  = ${cvstag}"/>
>   </target>
>
> Diane
>
> =====
> (holtdl@yahoo.com)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - sign up for Fantasy Baseball
> http://sports.yahoo.com
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: String translation/regex

Posted by Diane Holt <ho...@yahoo.com>.
--- Mark Derricutt <ma...@talios.com> wrote:
> This looks it'll do me, where does one find the script tag?  Its not in 
> optional/standard so I assume its another independant jar I need?

The <script> task comes with the standard optional tasks jar-file -- what
you don't have is the BSF and Rhino jars. You can either pick up the src
and build bsf.jar yourself (comes with a build.xml file), and have it
support as many of the supported languages as you want/need, or I can send
you mine, which was only compiled to handle Rhino (since that's all I felt
like dealing with :)  I can send you the js.jar file as well, or you can
visit the Rhino site and pick it up there.
 
Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: String translation/regex

Posted by Mark Derricutt <ma...@talios.com>.
This looks it'll do me, where does one find the script tag?  Its not in 
optional/standard so I assume its another independant jar I need?

Actually, does it have any tasks for validating javascript in jsp pages? 
Would be great to be able to trap any errors/problems in there before doing 
a dist...

--On Monday, 4 March 2002 2:06 p.m. -0800 Diane Holt <ho...@yahoo.com> 
wrote:

>   <script language="javascript"> <![CDATA[



                                   -- \m/ --
  "...if I seem super human I have been misunderstood." (c) Dream Theater
          mark@talios.com - ICQ: 1934853 JID: talios@myjabber.net

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: String translation/regex

Posted by Diane Holt <ho...@yahoo.com>.
--- Mark Derricutt <ma...@talios.com> wrote:
> I have a property thats set to "5.0.019" for a version number, but cvs
> tags don't allow .'s, is there a way to do a regex and change all
> the .'s to _'s  from ant?

Or if you don't want to deal with reading and writing a file (and want to
see Erik cringe :) --

  <property name="version" value="5.0.019"/>

  <target name="setTag">
  <script language="javascript"> <![CDATA[
    cvstag = projname.getProperty("version").replace('.', '_');
    projname.setProperty("cvstag", cvstag);
    ]]></script>
    <echo message="cvstag  = ${cvstag}"/>
  </target>

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>