Try the <replaceregexp> optional task.

Jan

> -----Ursprüngliche Nachricht-----
> Von: Ben Gill [mailto:[EMAIL PROTECTED]
> Gesendet am: Mittwoch, 13. Oktober 2004 12:35
> An: Ant Users List
> Betreff: RE: Substring / regex on a package name?
> 
> Thanks Ivan, that is great...
> 
> Re: the repackage - move certainly would be a start, but I was looking
> for a repackage task that would recurse from a point (ie. 
> '.') and move
> all dirs/java sources/props files etc.. into a new package 
> structure...
> 
> Ie. From com.oldapp to com.newapp ..
> 
> But also, I would want it to rename any paths in the files (ie.
> Com/oldapp to com/newapp) and any package names / import statements...
> 
> I had to write something like this last week, it is not quite generic
> enough to make it an offering as an optional task as yet... but I
> wondered if there was anything else out there like this....  I saw a
> rename packages task on java.dev.net somewhere but it did not seem to
> work..
> 
> Ben
> 
> 
> -----Original Message-----
> From: Ivan Ivanov [mailto:[EMAIL PROTECTED] 
> Sent: 13 October 2004 10:22
> To: Ant Users List
> Subject: Re: Substring / regex on a package name?
> 
> Hello, 
> > Hi,
> > 
> > I have two questions:
> > 
> > 1) I have a property called "com.myapp" within my
> > build.xml file (or at
> > least loaded in at runtime), and I want to strip off
> > everything past the
> > first dot (to get the base package name com)...
> > 
> > Is that possible?
> 
> You can use ant-contrib[1] task PropertyRegex, an
> example copied directly from[2] shows that it is
> possible:
>     <propertyregex property="pack.name"
>               input="package.ABC.name"
>               regexp="package\.([^\.]*)\.name"
>               select="\1"
>               casesensitive="false" />
>     
> This will yield ABC.
> 
> Or you can using a scripting language (like
> javascript) in ant to manipulate your string (but I am
> not so good in it to provide sample).
> 
> > 
> > 2) Is there a rename packages ANT task?
> > 
> There is a <move> task that can rename the packages
> viewed as directories. Is this want you want>
> 
> [1]http://ant-contrib.sourceforge.net
> [2]http://ant-contrib.sourceforge.net/tasks/propertyregex.html
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> 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