ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David <>
Subject Re:How to use replaceregexp in multi-line context?
Date Thu, 18 May 2006 14:50:17 GMT
Dear Oliver, 
  Thanks for your interest on my problem. Concerning to your comment, I don't understand wery
will, please could you be a little bit more explicit.
  As far as I understand, I think you mean to include the new line character on the match
expression. I was tested this too, without success, so:
  <replaceregexp byline = "false" flags = "g"
  doesn't work, so adding the \n character. I have tested to using the java property 
  ${line.separator}, so:
  <replaceregexp byline = "false" flags = "g"
  both solutions compiles with Ant, but the input file doesn't change.
  I have a simple example that work on multi-line context, but I don't have to specify the
list of allowed characters on the match expression:
          <replaceregexp byline = "false" flags = "gs">
            <regexp pattern = "${CVI.begin}(.*)${CVI.end}"/>
            <substitution expression = "${CVI.begin}${nl}${}${CVI.end}"/>
             <fileset dir = ".">
                <exclude name="**/*.properties"/>
                <patternset refid = "java.patternset"/>
  CVI.begin                   = @BEGIN_CONTROL_VERSION_INFO@
CVI.end                     = @END_CONTROL_VERSION_INFO@
  and ${nl} = ${line.separator}, with this peace of code the delete the contains of the CVI
block code, for example:
Control Version Information
$Log:,v $
Revision 1.4  2004/10/04 19:24:03  UF367151
Checkstyle test passed.
  Revision 1.3  2004/09/14 17:56:48  UF367151
  for this case is easy because the end token is at new line and it is a string instead of
character like my case(";"), so we can specify the "s" flag and "eat" every thing with .*
pattern (including the new line because the "s" option stays that)
  Please let me know any suggestion about that,

Be a chatter box. Enjoy free PC-to-PC calls  with Yahoo! Messenger with Voice.
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message