dcsimg
Using regexp mapper and properties to rename a file to a property value whose property name is picked up from the original name using regex
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chandrika_N
Posted On:   Friday, April 28, 2006 12:06 PM

I want to rename a set of files so that the place holders @xx@ in the file name are replaced by a property value whose property name is: xx Eg: Suppose the file names are: @server_name_1@.txt.filter @server_name_2@.txt.filter and the property values are: When the following code is executed: to="1${2}3"/> the file names should be: SERVER1.txt SERVER2.txt Instead I am getting: ${server_name_1}.txt ${server_name_2}.txt What am I doing wron   More>>


I want to rename a set of files so that the place holders @xx@ in the file name are replaced by a property value whose property name is: xx



Eg:

Suppose the file names are:

@server_name_1@.txt.filter

@server_name_2@.txt.filter




and the property values are:









When the following code is executed:

			



to="1${2}3"/>



the file names should be:

SERVER1.txt

SERVER2.txt



Instead I am getting:

${server_name_1}.txt

${server_name_2}.txt



What am I doing wrong..



Thanks    <<Less

Re: Using regexp mapper and properties to rename a file to a property value whose property name is picked up from the original name using regex

Posted By:   Anonymous  
Posted On:   Tuesday, May 2, 2006 02:46 AM

Passing a to="1${2}3" means exactly: passing that string to Ant. There is no additional step in property replacement. Ant checks the string 1${2}3 and find a ${2} (dont know if it would replace that, if you had a property 2). Next is passes that string to the mapper which resolves the -references. That mapper does not do any property replacement. Maybe a could help, because you dont have to deal with back-references.
About | Sitemap | Contact