You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by João Augusto Charnet <jo...@sfw.com.br> on 2005/09/26 22:28:40 UTC

Regexp patterns

Hello,
I'm need to do 4 replaces in more than 100 files, using replaceregexp task.
My problem is that I'm doing 4 times the replaceregexp task, and it's 
beeing to costly.
Is there a way I can tell the replaceregexp task to find more than one 
pattern in a file, instead of only one ?

Thanks a lot.
John
-- 

<http://www.sfw.com.br>Softway & Softcomex

	

Jo�o Augusto Charnet
Computer Engineer - R&D Team

Phone/Fax: 55 19 3739-9261
E-mail: joao.charnet@sfw.com.br <ma...@sfw.com.br>
R. Conceicao, 233 - Cj, 609 - Centro
13010-050 - Campinas - SP - Brazil


Re: Regexp patterns

Posted by João Augusto Charnet <jo...@sfw.com.br>.
Worked perfectly.
Thanks Andrew, and Jon ....

John.
Jon McLennan wrote:

> Actually, you should only need to put parentheses around the entire 
> pattern:
>
> match="(pattern1|pattern2|pattern3|pattern4)" replace=""
>
> Jon
>
> Andrew Goktepe wrote:
>
>> Try this:
>>  
>> match="pattern1|pattern2|pattern3|pattern4" replace=""
>>  
>> If that doesn't work try putting parentheses around each pattern in 
>> the above regexp
>>  
>> -Andrew
>>
>>  
>> On 9/27/05, *Jo�o Augusto Charnet* <joao.charnet@sfw.com.br 
>> <ma...@sfw.com.br>> wrote:
>>
>>     In this case yes.
>>     Actually I'm removing these patterns, replacing them with a "" .
>>
>>     John.
>>
>>     Andrew Goktepe wrote:
>>
>>>     Are you replacing the same string for all 4 patterns?
>>>          -Andrew
>>>
>>>          On 9/26/05, *Jo�o Augusto Charnet* <joao.charnet@sfw.com.br
>>>     <ma...@sfw.com.br>> wrote:
>>>
>>>         Hello,
>>>         I'm need to do 4 replaces in more than 100 files, using
>>>         replaceregexp task.
>>>         My problem is that I'm doing 4 times the replaceregexp task,
>>>         and it's beeing to costly.
>>>         Is there a way I can tell the replaceregexp task to find more
>>>         than one pattern in a file, instead of only one ?
>>>
>>>         Thanks a lot.
>>>         John
>>>         --
>>>         <http://www.sfw.com.br/>*Softway & Softcomex *
>>>
>>>            
>>>
>>>         *Jo�o Augusto Charnet*
>>>         Computer Engineer - R&D Team
>>>
>>>         *Phone/Fax: 55 19 3739-9261
>>>         E-mail: joao.charnet@sfw.com.br 
>>> <ma...@sfw.com.br>
>>>         R. Conceicao, 233 - Cj, 609 - Centro
>>>         13010-050 - Campinas - SP - Brazil
>>>         *
>>>
>>>
>>
>>
>>     --
>>     <http://www.sfw.com.br/>*Softway & Softcomex *
>>
>>        
>>
>>     *Jo�o Augusto Charnet*
>>     Computer Engineer - R&D Team
>>
>>     *Phone/Fax: 55 19 3739-9261
>>     E-mail: joao.charnet@sfw.com.br <ma...@sfw.com.br>
>>     R. Conceicao, 233 - Cj, 609 - Centro
>>     13010-050 - Campinas - SP - Brazil
>>     *
>>
>>
>


-- 

<http://www.sfw.com.br>Softway & Softcomex

	

Jo�o Augusto Charnet
Computer Engineer - R&D Team

Phone/Fax: 55 19 3739-9261
E-mail: joao.charnet@sfw.com.br <ma...@sfw.com.br>
R. Conceicao, 233 - Cj, 609 - Centro
13010-050 - Campinas - SP - Brazil


Re: Regexp patterns

Posted by Jon McLennan <jm...@clear2pay.com>.
Actually, you should only need to put parentheses around the entire pattern:

match="(pattern1|pattern2|pattern3|pattern4)" replace=""

Jon

Andrew Goktepe wrote:

> Try this:
>  
> match="pattern1|pattern2|pattern3|pattern4" replace=""
>  
> If that doesn't work try putting parentheses around each pattern in 
> the above regexp
>  
> -Andrew
>
>  
> On 9/27/05, *João Augusto Charnet* <joao.charnet@sfw.com.br 
> <ma...@sfw.com.br>> wrote:
>
>     In this case yes.
>     Actually I'm removing these patterns, replacing them with a "" .
>
>     John.
>
>     Andrew Goktepe wrote:
>
>>     Are you replacing the same string for all 4 patterns?
>>      
>>     -Andrew
>>
>>      
>>     On 9/26/05, *João Augusto Charnet* <joao.charnet@sfw.com.br
>>     <ma...@sfw.com.br>> wrote:
>>
>>         Hello,
>>         I'm need to do 4 replaces in more than 100 files, using
>>         replaceregexp task.
>>         My problem is that I'm doing 4 times the replaceregexp task,
>>         and it's beeing to costly.
>>         Is there a way I can tell the replaceregexp task to find more
>>         than one pattern in a file, instead of only one ?
>>
>>         Thanks a lot.
>>         John
>>         -- 
>>
>>         <http://www.sfw.com.br/>*Softway & Softcomex *
>>
>>         	
>>
>>         *João Augusto Charnet*
>>         Computer Engineer - R&D Team
>>
>>         *Phone/Fax: 55 19 3739-9261
>>         E-mail: joao.charnet@sfw.com.br <ma...@sfw.com.br>
>>         R. Conceicao, 233 - Cj, 609 - Centro
>>         13010-050 - Campinas - SP - Brazil
>>         *
>>
>>
>
>
>     -- 
>
>     <http://www.sfw.com.br/>*Softway & Softcomex *
>
>     	
>
>     *João Augusto Charnet*
>     Computer Engineer - R&D Team
>
>     *Phone/Fax: 55 19 3739-9261
>     E-mail: joao.charnet@sfw.com.br <ma...@sfw.com.br>
>     R. Conceicao, 233 - Cj, 609 - Centro
>     13010-050 - Campinas - SP - Brazil
>     *
>
>

Re: Regexp patterns

Posted by Andrew Goktepe <an...@gmail.com>.
Try this:
 match="pattern1|pattern2|pattern3|pattern4" replace=""
 If that doesn't work try putting parentheses around each pattern in the
above regexp
 -Andrew

 On 9/27/05, João Augusto Charnet <jo...@sfw.com.br> wrote:
>
> In this case yes.
> Actually I'm removing these patterns, replacing them with a "" .
>
> John.
> Andrew Goktepe wrote:
>
> Are you replacing the same string for all 4 patterns?
>  -Andrew
>
>  On 9/26/05, João Augusto Charnet <jo...@sfw.com.br> wrote:
> >
> > Hello,
> > I'm need to do 4 replaces in more than 100 files, using replaceregexp
> > task.
> > My problem is that I'm doing 4 times the replaceregexp task, and it's
> > beeing to costly.
> > Is there a way I can tell the replaceregexp task to find more than one
> > pattern in a file, instead of only one ?
> >
> > Thanks a lot.
> > John
> > --
> >
> > <http://www.sfw.com.br/>*Softway & Softcomex *
> >
> > *João Augusto Charnet*
> > Computer Engineer - R&D Team
> >
> > *Phone/Fax: 55 19 3739-9261
> > E-mail: joao.charnet@sfw.com.br
> > R. Conceicao, 233 - Cj, 609 - Centro
> > 13010-050 - Campinas - SP - Brazil
> > *
> >
>
>
>
> --
>
> <http://www.sfw.com.br/>*Softway & Softcomex*
>
> *João Augusto Charnet*
> Computer Engineer - R&D Team
>
> *Phone/Fax: 55 19 3739-9261
> E-mail: joao.charnet@sfw.com.br
> R. Conceicao, 233 - Cj, 609 - Centro
> 13010-050 - Campinas - SP - Brazil
> *
>

Re: Regexp patterns

Posted by João Augusto Charnet <jo...@sfw.com.br>.
In this case yes.
Actually I'm removing these patterns, replacing them with a "" .

John.
Andrew Goktepe wrote:

> Are you replacing the same string for all 4 patterns?
>  
> -Andrew
>
>  
> On 9/26/05, Jo�o Augusto Charnet <joao.charnet@sfw.com.br 
> <ma...@sfw.com.br>> wrote:
>
>     Hello,
>     I'm need to do 4 replaces in more than 100 files, using
>     replaceregexp task.
>     My problem is that I'm doing 4 times the replaceregexp task, and
>     it's beeing to costly.
>     Is there a way I can tell the replaceregexp task to find more than
>     one pattern in a file, instead of only one ?
>
>     Thanks a lot.
>     John
>     -- 
>
>     <http://www.sfw.com.br/>Softway & Softcomex
>
>     	
>
>     Jo�o Augusto Charnet
>     Computer Engineer - R&D Team
>
>     Phone/Fax: 55 19 3739-9261
>     E-mail: joao.charnet@sfw.com.br <ma...@sfw.com.br>
>     R. Conceicao, 233 - Cj, 609 - Centro
>     13010-050 - Campinas - SP - Brazil
>
>


-- 

<http://www.sfw.com.br>Softway & Softcomex

	

Jo�o Augusto Charnet
Computer Engineer - R&D Team

Phone/Fax: 55 19 3739-9261
E-mail: joao.charnet@sfw.com.br <ma...@sfw.com.br>
R. Conceicao, 233 - Cj, 609 - Centro
13010-050 - Campinas - SP - Brazil


Re: Regexp patterns

Posted by Andrew Goktepe <an...@gmail.com>.
Are you replacing the same string for all 4 patterns?
 -Andrew

 On 9/26/05, João Augusto Charnet <jo...@sfw.com.br> wrote:
>
> Hello,
> I'm need to do 4 replaces in more than 100 files, using replaceregexp
> task.
> My problem is that I'm doing 4 times the replaceregexp task, and it's
> beeing to costly.
> Is there a way I can tell the replaceregexp task to find more than one
> pattern in a file, instead of only one ?
>
> Thanks a lot.
> John
> --
>
> <http://www.sfw.com.br/>*Softway & Softcomex*
>
> *João Augusto Charnet*
> Computer Engineer - R&D Team
>
> *Phone/Fax: 55 19 3739-9261
> E-mail: joao.charnet@sfw.com.br
> R. Conceicao, 233 - Cj, 609 - Centro
> 13010-050 - Campinas - SP - Brazil
> *
>