ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Ashoff" <Oliver.Ash...@xtramind.com>
Subject AW: How to use replaceregexp in multi-line context?
Date Wed, 17 May 2006 10:41:01 GMT
Hi David!

Inserting a new line  

   &#10;

in the regular expression so that 
line endings/transitions are matched
may help.
After that my multi-line regexp work.

I wonder if the ant regexp multi-line mode
is platform dependent as far as the line endings 
are concerned? 
Or if I missed something. :)

Regards,

Oliver




> -----Urspr├╝ngliche Nachricht-----
> Von: David [mailto:achepati67@yahoo.es] 
> Gesendet: Mittwoch, 17. Mai 2006 11:59
> An: Ant Apache User Group
> Betreff: How to use replaceregexp in multi-line context?
> 
> Dear members,
>    
>   I would like to use the ant task replaceregexp in order to 
> replace tablespace information on my sql scripts, my input 
> file is some think like this:
>    
>   CREATE INDEX IX_2_lra_country
>  ON @USER@.lra_country (be_code)
>  PCTFREE    10
>   INITRANS   2
>   MAXTRANS   255
>   TABLESPACE @TABLESPACE@
>  STORAGE (
>    INITIAL     524288
>    NEXT        524288
>    PCTINCREASE 0
>    MINEXTENTS  2
>    MAXEXTENTS  2147483645
>    )
> ;
>    
>   I have found the following regular expresion will match 
> what I want: ^[\s]*PCTFREE[\sa-zA-Z0-9@\(\)]*; so I want to 
> replace all of this with the semi-colon symbol(";").
>    
>   I am ussing the following invocation of replaceregexp:
>    
>   <replaceregexp byline = "false" flags = "g"
>    file="${sql.dir}/oracle/lra-create-index-oracle.sql"
>    match="^[\s]*PCTFREE[\sa-zA-Z0-9@\(\)]*;"
>    replace=";">
>   </replaceregexp>
>    
>   When I test this regular expression it works (but not under 
> Ant). I get:
>    
>   CREATE INDEX IX_2_lra_country
>  ON @USER@.lra_country (be_code);
>    
>    It doesn't work with Ant because the regular expresion to 
> find is spread in more than one line. If I put all in one 
> line it matches the regular expression. I don't understand 
> why because the \s includes the newline character too. I have 
> tried to use the flag="sg" without success too and also to 
> set byline="true".
>    
>   Do you have any suggestion about that?,
>    
>   Thanks in advance,
>    
>   David
> 
> 		
> ---------------------------------
> Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries 
> for just 2¢/min with Yahoo! Messenger with Voice.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message