antoine     2003/11/24 13:56:53

  Modified:    docs/manual/OptionalTasks replaceregexp.html
  Log:
  added details concerning the choice of the regular expression implementation.
  Also fixed an example, the substitution tag accepts the attribute expression, 
not pattern.
  
  Revision  Changes    Path
  1.17      +48 -28    ant/docs/manual/OptionalTasks/replaceregexp.html
  
  Index: replaceregexp.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/replaceregexp.html,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- replaceregexp.html        23 Jul 2003 12:57:18 -0000      1.16
  +++ replaceregexp.html        24 Nov 2003 21:56:53 -0000      1.17
  @@ -4,10 +4,9 @@
   <meta http-equiv="Content-Language" content="en-us">
   <title>ReplaceRegExp Task</title>
   </head>
  -
   <body>
   
  -<h2><a name="replace">ReplaceRegExp</a></h2>
  +<h2><a name="replaceregexp">ReplaceRegExp</a></h2>
   <h3>Description</h3>
   <p>ReplaceRegExp is a directory based task for replacing the
   occurrence of a given regular expression with a substitution pattern
  @@ -20,28 +19,7 @@
   <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>org.apache.tools.ant.util.regexp.Regexp</code>.  Ant comes with
  -implementations for
  -<a 
href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html";
 target="_top">the java.util.regex package of JDK 1.4</a>,
  -<a href="http://jakarta.apache.org/regexp/"; target="_top">jakarta-regexp</a>
  -and <a href="http://jakarta.apache.org/oro/"; target="_top">jakarta-ORO</a>,
  -but you will still need the library itself.</p>
  -<p>
  -<i>
  -There are cross-platform issues for matches related to line terminator.
  -For example if you use $ to anchor your regular expression on the end of a 
line
  -the results might be very different depending on both your platform and the 
regular
  -expression library you use. It is 'highly recommended' that you test your 
pattern on
  -both Unix and Windows platforms before you rely on it.
  -<ul>
  -    <li>Jakarta Oro defines a line terminator as '\n' and is consistent with 
Perl.</li>
  -    <li>Jakarta RegExp uses a system-dependant line terminator.</li>
  -    <li>JDK 1.4 uses '\n', '\r\n', '\u0085', '\u2028', '\u2029' as a default
  -    but is configured in the wrapper to use only '\n' (UNIX_LINE)</li>
  -</ul>
  -We <b>strongly</b> recommend that you use Jakarta Oro.
  -</i>
  -</p>
  +<code>org.apache.tools.ant.util.regexp.Regexp</code>. See details <a 
href="#implementation">below</a>. </p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  @@ -74,6 +52,7 @@
                        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>
       <td valign="top" align="center">No</td>
     </tr>
     <tr>
  @@ -100,6 +79,47 @@
   <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}/build.properties</code></p>
  +<a name="implementation"/>
  +<h3>Choice of regular expression implementation</h3>
  +<p>
  +Ant comes with
  +wrappers for
  +<a 
href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html";
 target="_top">the java.util.regex package of JDK 1.4</a>,
  +<a href="http://jakarta.apache.org/regexp/"; target="_top">jakarta-regexp</a>
  +and <a href="http://jakarta.apache.org/oro/"; target="_top">jakarta-ORO</a>,
  +See <a href="../install.html#librarydependencies">installation 
dependencies</a>
  + concerning the supporting libraries.</p>
  +<p>
  +The system property <code>ant.regexp.regexpimpl</code> governs which regular 
expression implementation will be chosen.
  +Possible values for this property are :
  +<ul>
  +<li>
  +org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp
  +</li>
  +<li>
  +org.apache.tools.ant.util.regexp.JakartaOroRegexp
  +</li>
  +<li>
  +org.apache.tools.ant.util.regexp.JakartaRegexpRegexp
  +</li>
  +</ul>
  +It can also be another implementation of the interface 
<code>org.apache.tools.ant.util.regexp.Regexp</code>.
  +If <code>ant.regexp.regexpimpl</code> is not defined, ant checks in the 
order Jdk14Regexp, JakartaOroRegexp,
  + JakartaRegexp for the availability of the corresponding library. The first 
of these 3 which is found will be used.</p>
  +<p>
  +There are cross-platform issues for matches related to line terminator.
  +For example if you use $ to anchor your regular expression on the end of a 
line
  +the results might be very different depending on both your platform and the 
regular
  +expression library you use. It is 'highly recommended' that you test your 
pattern on
  +both Unix and Windows platforms before you rely on it.
  +<ul>
  +    <li>Jakarta Oro defines a line terminator as '\n' and is consistent with 
Perl.</li>
  +    <li>Jakarta RegExp uses a system-dependant line terminator.</li>
  +    <li>JDK 1.4 uses '\n', '\r\n', '\u0085', '\u2028', '\u2029' as a default
  +    but is configured in the wrapper to use only '\n' (UNIX_LINE)</li>
  +</ul>
  +<em>We <b>strongly</b> recommend that you use Jakarta Oro.</em>
  +</p>
   <h3>Parameters specified as nested elements</h3>
   <p>This task supports a nested <a 
href="../CoreTypes/fileset.html">FileSet</a>
      element.</p>
  @@ -107,14 +127,14 @@
      the regular expression.  You can use this element to refer to a previously
      defined regular expression datatype instance.</p>
   <blockquote>
  -     &lt;regexp id="id" pattern="expression"/&gt;<br />
  +     &lt;regexp id="id" pattern="alpha(.+)beta"/&gt;<br />
        &lt;regexp refid="id"/&gt;
   </blockquote>
   <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 substitution pattern datatype instance.</p>
   <blockquote>
  -     &lt;substitution id="id" pattern="expression"/&gt;<br />
  +     &lt;substitution id="id" expression="beta\1alpha"/&gt;<br />
        &lt;substitution refid="id"/&gt;
   </blockquote>
   <h3>Examples</h3>
  @@ -151,8 +171,8 @@
   &lt;html&gt; &lt;body&gt;
    &lt;h1&gt; T E S T &lt;/h1&gt; &lt;/body&gt;&lt;/html&gt;
   </pre>
  -
  -<hr>
  +</p>
  +<hr/>
   <p align="center">Copyright &copy; 2001-2003 Apache Software Foundation. All 
rights
   Reserved.</p>
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to