You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ben Gill <Be...@t-mobile.co.uk> on 2004/10/13 10:39:08 UTC

Substring / regex on a package name?

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?

 

2) Is there a rename packages ANT task?

 

Thanks


Re: Substring / regex on a package name?

Posted by Ivan Ivanov <ra...@yahoo.com>.
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org