ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: AW: Backspace in regular expression
Date Wed, 23 Jun 2004 07:09:54 GMT
Hi Oliver and Peter, thank you for your answers.
However, I still fail to make it. I am trying the
following snippet:

<target name="replacebcks" description="Replace a
pattern with a backspace">
    <replaceregexp file="bcks.txt" byline="true">
        <regexp pattern="eva"/>
        <substitution expression="#&10;"/>
    </replaceregexp>
</target>

and the file bcks.txt contains 
treva
greva
preva

I expect after successful execution the file to
contain
t
g
p

However when I invoke the above snippet ant complaints
for the &: The entity name must immediately follow the
'&' in the entity reference.

If I change <substitution> atribute to <substitution
expression="#&amp;10;"/> it runs but the result file
contains
tr#&10;
gr#&10;
pr#&10;

which is not what I expect. 

Finally, when I change <substituion> attribute to
<substition expression="\\\\b"/> the result in
bcks.txt is 
tr\b
gr\b
pr\b

So no success here. Any hints on how to make one of
these work?

Thank you for your help 
Ivan

--- Oliver Ashoff <Oliver.Ashoff@xtramind.com> wrote:
> 
> 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
> 
> 



		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
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


Mime
View raw message