ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Winton <greg.win...@gmail.com>
Subject Re: <replaceregexp>
Date Thu, 20 Oct 2005 16:05:40 GMT
change "[A-Z0-9]" to "[A-Z0-9]+". Also, your parentheses are still such that
you will be appending "&quot;kalle&quot;" to the entire string. You can
simplify the logic a bit since the first part of the match will not change.

<replaceregexp file="index.htm">
<regexp pattern="#34;CUSTOM_APPL
>
> _REV&#34; VALUE = &#34;[A-Z0-9]&#34;\)"/>
> <substitution expression="#34;CUSTOM_APPL
> >
> > _REV&#34; VALUE =&#34;kalle&#34"/>
>
>  </replaceregexp>
>

This could be further clarrified by putting everything up to
"&#34;kalle&#34" into a property.

This is untested but should work.

Greg

On 10/20/05, Mikael Petterson (KI/EAB) <mikael.petterson@ericsson.com>
wrote:
>
> Hi,
>
> I am trying:
>
> <replaceregexp file="index.htm">
> <regexp pattern="\(*&#34;CUSTOM_APPL_REV&#34; VALUE =
> &#34;[A-Z0-9]&#34;\)"/>
> <substitution expression="\1 kalle"/>
> </replaceregexp>
>
> but still no match.
>
> This is the line:
>
> <PARAM NAME = "CUSTOM_APPL_REV" VALUE = "R11A02">
>
> cheers,
>
> //mikael
>
> -----Original Message-----
> From: Jakob Fix [mailto:jakob.fix@gmail.com]
> Sent: den 20 oktober 2005 16:21
> To: Ant Users List
> Subject: Re: <replaceregexp>
>
>
> On 20/10/05, Greg Winton <greg.winton@gmail.com> wrote:
> > Mikael,
> >
> > >> &#34;
> >
> > >This is a numeric (hexadecimal) entity representing the >double quote
> > > >character. You can use it to represent double quote >characters
> inside
> > > >attribute values.
> > >
> >
> > you can use "&quot;" as well. I find this a little less cryptic.
> >
> > > try this:
> > > > <replaceregexp file="index.htm">
> > > > <regexp pattern="^.*\(&#34;CUSTOM_APPL_REV&#34;.*VALUE =
> > > > &#34;[A-Z0-9]&#34;\)"/>
> > > > <substitution
> > > > expression="\1${product_number_html}\_${product_revision_html}"/>
> > > > </replaceregexp>
> >
> >
> > I believe this will still not work unless you surround the "^.*" in
> > parentheses as well. "\1" matches the first grouped pattern (ie, pattern
> in
> > parentheses), "\2" matches the second, etc. That sa id, I am relatively
> new
> > to ant and it's regex syntax may vary from those I am used to.
>
> I would actually suggest to use non-greedy regex constructs for the
> two occurrences of ".*", otherwise you may have cases where your
> catchall expressions match more than you want.
>
> [^&#34;]* zero or more characters that are not a double quote (you may
> have to escape special characters :-)) - so as to match everything up
> to the first double quote.
>
> [^V]+ one or more characters that are not a capital V - avoids
> matching more than wanted.
>
> This is all untested.
>
> --
> cheers,
> Jakob.
>
> ---------------------------------------------------------------------
> 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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message