ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: backslash and CRLF in regular expression
Date Wed, 23 Jun 2004 06:33:39 GMT
Hi Luis the following snippet will do the job:

<target name="replace" description="Removes new lines
from a file">
    <replaceregexp file="myfile" flags="g">
        <regexp pattern="${line.separator}"/>
        <substitution expression=""/>
    </replaceregexp>
</target>

HTH Ivan

--- luis.conelly@ge.com wrote:
> Hi all,
> 
> 	It turns out that I have these files that have
> several lines like
> following:
> 
> blablabla blabla bla \
> blablabla blabla bla \
> blablabla blabla bla;
> 
> and I want to make a single line like:
> 
> blablabla blabla bla blablabla blabla bla blablabla
> blabla bla;
> 
> I have tried this:
> 
>     <target name="replace">
>         <replaceregexp byline="true" file="myfile">
> 	    <regexp pattern="\\
"/>
>           <substitution expression=""/>
>          </replaceregexp>
>     </target>
> 
> Also, I've used as value for <regexp pattern>
> following:
> 
> <regexp pattern="\\ 

"/>
> <regexp pattern="\\

"/>
> <regexp pattern="\\
"/>
> <regexp pattern="\\
"/>
> <regexp pattern="\\ \n\r"/>
> <regexp pattern="\\ \r\n"/>
> <regexp pattern="\\\n\r"/>
> <regexp pattern="\\\r\n"/>
> <regexp pattern="\\\n"/>
> <regexp pattern="\\\r"/>
> 
> Any ideas out there? I am running out of them right
> now.
> 
> Appreciate your help on this issue
> 
> Regards.
> Luis
> 
> -----Original Message-----
> From: Oliver Ashoff
> [mailto:Oliver.Ashoff@xtramind.com]
> Sent: Tuesday, June 22, 2004 10:59 AM
> To: Ant Users List
> Subject: AW: Backspace in regular expression
> 
> 
> 
> Try 
>     
> instead of 
>     \b
> In general, the expression 
>     #&<decnum>;
> encodes any character where
> <decnum> is a number in decimal notation.
> 
> Works fine with LINE FEED: #&10;
> 
> Oliver 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Ivan Ivanov
> [mailto:rambiusparkisanius@yahoo.com] 
> > Gesendet: Dienstag, 22. Juni 2004 12:02
> > An: user@ant.apache.org
> > Betreff: Backspace in regular expression
> > 
> > 
> > Dear Colleagues,
> > 
> > I want to replace a string in a file with
> backspace,
> > but I do not know how to escape backspace literal
> > "\b". I tried
> > <replaceregexp byline="true" file="myfile">
> >     <regexp pattern="alabala"/>
> >     <substitution expression="\b"/>
> > </replaceregexp>
> > 
> > but it replace "alabala" with letter "b" and some
> > other variants but with no success.
> > 
> > Regards Ivan
> > 
> > 
> > 
> > 
> > 	
> > 		
> > __________________________________
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - 100MB free storage!
> > http://promotions.yahoo.com/new_mail 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> > 
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
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


Mime
View raw message