ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: jakarta-ant/docs/manual/OptionalTasks replaceregexp.html
Date Mon, 12 Nov 2001 11:26:48 GMT
bodewig     01/11/12 03:26:48

  Modified:    .        bootstrap.bat build.bat
               docs/manual optionaltasklist.html
  Added:       docs/manual/OptionalTasks replaceregexp.html
  Add documentation for the replaceregexp task
  Submitted by:	Matthew Inger <>
  Revision  Changes    Path
  1.41      +1 -1      jakarta-ant/bootstrap.bat
  Index: bootstrap.bat
  RCS file: /home/cvs/jakarta-ant/bootstrap.bat,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- bootstrap.bat	2001/10/23 06:10:50	1.40
  +++ bootstrap.bat	2001/11/12 11:26:47	1.41
  @@ -23,7 +23,7 @@
   if     "%OS%" == "Windows_NT" if exist build\classes\nul rmdir/s/q build\classes
   if not "%OS%" == "Windows_NT" if exist build\classes\nul deltree/y build\classes
  -SET LOCALCLASSPATH=lib\crimson.jar;lib\jaxp.jar;
  +SET LOCALCLASSPATH=lib\crimson.jar
   for %%i in (lib\optional\*.jar) do call src\script\lcp.bat %%i
   if exist "%JAVA_HOME%\lib\tools.jar" call src\script\lcp.bat %JAVA_HOME%\lib\tools.jar
   if exist "%JAVA_HOME%\lib\" call src\script\lcp.bat %JAVA_HOME%\lib\
  1.54      +1 -1      jakarta-ant/
  RCS file: /home/cvs/jakarta-ant/,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  ---	2001/10/23 06:10:50	1.53
  +++	2001/11/12 11:26:47	1.54
  @@ -68,7 +68,7 @@
     rm -r build/classes
   for i in ${DIRLIBS}
  1.31      +1 -1      jakarta-ant/build.bat
  Index: build.bat
  RCS file: /home/cvs/jakarta-ant/build.bat,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- build.bat	2001/08/30 13:29:20	1.30
  +++ build.bat	2001/11/12 11:26:47	1.31
  @@ -10,7 +10,7 @@
   goto cleanup
  -set LOCALCLASSPATH=lib\crimson.jar;lib\jaxp.jar;bootstrap\lib\ant.jar
  +set LOCALCLASSPATH=lib\crimson.jar;bootstrap\lib\ant.jar
   for %%i in (lib\optional\*.jar) do call bootstrap\bin\lcp.bat %%i
   set CLASSPATH=lib\optional\xalanj1compat.jar;%LOCALCLASSPATH%;%CLASSPATH%
  1.24      +1 -1      jakarta-ant/
  RCS file: /home/cvs/jakarta-ant/,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  ---	2001/08/06 10:24:02	1.23
  +++	2001/11/12 11:26:47	1.24
  @@ -13,7 +13,7 @@
   # add in the dependency .jar files
   for i in ${DIRLIBS}
  1.21      +1 -0      jakarta-ant/docs/manual/optionaltasklist.html
  Index: optionaltasklist.html
  RCS file: /home/cvs/jakarta-ant/docs/manual/optionaltasklist.html,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- optionaltasklist.html	2001/11/02 23:30:44	1.20
  +++ optionaltasklist.html	2001/11/12 11:26:48	1.21
  @@ -39,6 +39,7 @@
   <a href="OptionalTasks/propertyfile.html">PropertyFile</a><br>
   <a href="OptionalTasks/pvcstask.html">Pvcs</a><br>
   <a href="OptionalTasks/renameextensions.html"><i>RenameExtensions</i></a><br>
  +<a href="OptionalTasks/replaceregexp.html">ReplaceRegExp</a><br>
   <a href="OptionalTasks/rpm.html">Rpm</a><br>
   <a href="OptionalTasks/script.html">Script</a><br>
   <a href="OptionalTasks/sound.html">Sound</a><br>
  1.1                  jakarta-ant/docs/manual/OptionalTasks/replaceregexp.html
  Index: replaceregexp.html
  <meta http-equiv="Content-Language" content="en-us">
  <title>Ant User Manual</title>
  <h2><a name="replace">ReplaceRegExp</a></h2>
  <p>ReplaceRegExp is a directory based task for replacing the
  occurrence of a given regular expression with a substitution pattern
  in a selected file or set of files.</p>
  <p>Similar to <a href="../CoreTypes/mapper.html#regexp-mapper">regexp
  type mappers</a> this task needs a supporting regular expression
  library and an implementation of
  <code></code>.  Ant comes with
  implementations for 
  <a href=""
target="_top">the java.util.regex package of JDK 1.4</a>, 
  <a href="" target="_top">jakarta-regexp</a>

  and <a href="" target="_top">jakarta-ORO</a>,
  but you will still need the library itself.</p>
  <table border="1" cellpadding="2" cellspacing="0">
      <td valign="top"><b>Attribute</b></td>
      <td valign="top"><b>Description</b></td>
      <td align="center" valign="top"><b>Required</b></td>
      <td valign="top">file</td>
      <td valign="top">file for which the regular expression should be replaced.</td>
      <td align="center">Yes if no nested &lt;fileset&gt; is used</td>
      <td valign="top">match</td>
      <td valign="top">The regular expression pattern to match in the file(s)</td>
      <td align="center">Yes, if no nested &lt;regularexpression&gt; is used</td>
      <td valign="top">replace</td>
      <td valign="top">The substition pattern to place in the file(s) in place
                       of the regular expression.</td>
      <td align="center">Yes, if no nested &lt;substitution&gt; is used</td>
      <td valign="top">flags</td>
      <td valign="top">The flags to use when matching the regular expression.  For more
                       information, consult the Perl5 syntax<br />
                       g --> Global replacement.  Replace all occurances found<br />
                       i --> Case Insensitive.  Do not consider case in the match<br
                       m --> Multiline.  Treat the string as multiple lines of input, using
"^" and "$" as the start or end of any line, respectively, rather than start or end of string.<br
                       s --> Singleline.  Treat the string as a single line of input, using
"." to match any character, including a newline, which normally, it would not match.<br
      <td valign="top" align="center">No</td>
      <td valign="top">byline</td>
      <td valign="top">Process the file(s) one line at a time, executing the replacement
                       on one line at a time (<i>true/false</i>).  This is useful
if you
                       want to only replace the first occurance of a regular expression on
                       each line, which is not easy to do when processing the file as a whole.
                       Defaults to <i>false</i>.</td>
      <td valign="top" align="center">No</td>
  <pre>  &lt;replaceregexp file=&quot;${src}/; 
                           byline=&quot;true&quot; /&gt;
  <p>replaces occurrences of the property name &quot;OldProperty&quot;
   with &quot;NewProperty&quot; in a properties file, preserving the existing
  value, in the file <code>${src}/</code></p>
  <h3>Parameters specified as nested elements</h3>
  <p>This task supports a nested <a href="../CoreTypes/fileset.html">FileSet</a>

  <p>This task supports a nested <i>RegularExpression</i> element to specify
     the regular expression.  You can use this element to refer to a previously
     defined regular expression datatype instance.</p>
       &lt;regularexpression id="id" pattern="expression" /&gt;<br />
       &lt;regularexpression refid="id" /&gt;
  <p>This task supports a nested <i>Substitution</i> element to specify
     the substitution pattern.  You can use this element to refer to a previously
     defined substition pattern datatype instance.</p>
       &lt;substitution id="id" pattern="expression" /&gt;<br />
       &lt;substitution refid="id" /&gt;
  &lt;replaceregexp byline=&quot;true&quot;&gt;
    &lt;regularexpression expression=&quot;OldProperty=(.*)&quot; /&gt;
    &lt;substitution expression=&quot;NewProperty=\1&quot; /&gt;
    &lt;fileset dir=&quot;.&quot;&gt;
     &lt;includes=&quot;*.properties&quot; /&gt;
  <p>replaces occurrences of the property name &quot;OldProperty&quot;
   with &quot;NewProperty&quot; in a properties file, preserving the existing
  value, in all files ending in <code>.properties</code> in the current directory</p>
  <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message