Browse Source

<regularexpression> --> <regexp>

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271430 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
d3cd72efd0
5 changed files with 14 additions and 14 deletions
  1. +5
    -5
      docs/manual/OptionalTasks/replaceregexp.html
  2. +1
    -1
      src/etc/testcases/taskdefs/optional/replaceregexp.xml
  3. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
  4. +4
    -4
      src/main/org/apache/tools/ant/types/RegularExpression.java
  5. +1
    -1
      src/main/org/apache/tools/ant/types/defaults.properties

+ 5
- 5
docs/manual/OptionalTasks/replaceregexp.html View File

@@ -54,7 +54,7 @@ It is <b>strongly</b> recommended to use Jakarta Oro.
<tr> <tr>
<td valign="top">match</td> <td valign="top">match</td>
<td valign="top">The regular expression pattern to match in the file(s)</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 align="center">Yes, if no nested &lt;regexp&gt; is used</td>
</tr> </tr>
<tr> <tr>
<td valign="top">replace</td> <td valign="top">replace</td>
@@ -94,12 +94,12 @@ value, in the file <code>${src}/build.properties</code></p>
<h3>Parameters specified as nested elements</h3> <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 <a href="../CoreTypes/fileset.html">FileSet</a>
element.</p> element.</p>
<p>This task supports a nested <i>RegularExpression</i> element to specify
<p>This task supports a nested <i>Regexp</i> element to specify
the regular expression. You can use this element to refer to a previously the regular expression. You can use this element to refer to a previously
defined regular expression datatype instance.</p> defined regular expression datatype instance.</p>
<blockquote> <blockquote>
&lt;regularexpression id="id" pattern="expression" /&gt;<br />
&lt;regularexpression refid="id" /&gt;
&lt;regexp id="id" pattern="expression" /&gt;<br />
&lt;regexp refid="id" /&gt;
</blockquote> </blockquote>
<p>This task supports a nested <i>Substitution</i> element to specify <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 the substitution pattern. You can use this element to refer to a previously
@@ -112,7 +112,7 @@ value, in the file <code>${src}/build.properties</code></p>
<blockquote> <blockquote>
<pre> <pre>
&lt;replaceregexp byline=&quot;true&quot;&gt; &lt;replaceregexp byline=&quot;true&quot;&gt;
&lt;regularexpression expression=&quot;OldProperty=(.*)&quot; /&gt;
&lt;regexp expression=&quot;OldProperty=(.*)&quot; /&gt;
&lt;substitution expression=&quot;NewProperty=\1&quot; /&gt; &lt;substitution expression=&quot;NewProperty=\1&quot; /&gt;
&lt;fileset dir=&quot;.&quot;&gt; &lt;fileset dir=&quot;.&quot;&gt;
&lt;includes=&quot;*.properties&quot; /&gt; &lt;includes=&quot;*.properties&quot; /&gt;


+ 1
- 1
src/etc/testcases/taskdefs/optional/replaceregexp.xml View File

@@ -10,7 +10,7 @@


<target name="testReplace" depends="setup"> <target name="testReplace" depends="setup">
<replaceregexp file="test.properties" byline="true"> <replaceregexp file="test.properties" byline="true">
<regularexpression pattern="Old(.*)=(.*)" />
<regexp pattern="Old(.*)=(.*)" />
<substitution expression="NewProp=\1\2" /> <substitution expression="NewProp=\1\2" />
</replaceregexp> </replaceregexp>
</target> </target>


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -107,7 +107,7 @@ import java.util.Vector;
* replace="pattern" * replace="pattern"
* flags="options"? * flags="options"?
* byline="true|false"? &gt; * byline="true|false"? &gt;
* regularexpression?
* regexp?
* substitution? * substitution?
* fileset* * fileset*
* &lt;/replaceregexp&gt; * &lt;/replaceregexp&gt;
@@ -217,7 +217,7 @@ public class ReplaceRegExp extends Task
filesets.addElement(set); filesets.addElement(set);
} }


public RegularExpression createRegularExpression()
public RegularExpression createRegexp()
{ {
if (regex != null) { if (regex != null) {
throw new BuildException("Only one regular expression is allowed."); throw new BuildException("Only one regular expression is allowed.");


+ 4
- 4
src/main/org/apache/tools/ant/types/RegularExpression.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -83,7 +83,7 @@ import org.apache.tools.ant.util.regexp.RegexpFactory;
* </pre> * </pre>
* *
* <pre> * <pre>
* &lt;regularexpression [ [id="id"] pattern="expression" | refid="id" ]
* &lt;regexp [ [id="id"] pattern="expression" | refid="id" ]
* /&gt; * /&gt;
* </pre> * </pre>
* *
@@ -96,7 +96,7 @@ import org.apache.tools.ant.util.regexp.RegexpFactory;
*/ */
public class RegularExpression extends DataType public class RegularExpression extends DataType
{ {
public final static String DATA_TYPE_NAME = "regularexpression";
public final static String DATA_TYPE_NAME = "regexp";


// The regular expression factory // The regular expression factory
private final static RegexpFactory factory = new RegexpFactory(); private final static RegexpFactory factory = new RegexpFactory();
@@ -151,7 +151,7 @@ public class RegularExpression extends DataType
Object o = ref.getReferencedObject(p); Object o = ref.getReferencedObject(p);
if (!(o instanceof RegularExpression)) if (!(o instanceof RegularExpression))
{ {
String msg = ref.getRefId() + " doesn\'t denote a regularexpression";
String msg = ref.getRefId() + " doesn\'t denote a "+DATA_TYPE_NAME;
throw new BuildException(msg); throw new BuildException(msg);
} }
else else


+ 1
- 1
src/main/org/apache/tools/ant/types/defaults.properties View File

@@ -7,4 +7,4 @@ filterset=org.apache.tools.ant.types.FilterSet
description=org.apache.tools.ant.types.Description description=org.apache.tools.ant.types.Description
classfileset=org.apache.tools.ant.types.optional.depend.ClassfileSet classfileset=org.apache.tools.ant.types.optional.depend.ClassfileSet
substitution=org.apache.tools.ant.types.Substitution substitution=org.apache.tools.ant.types.Substitution
regularexpression=org.apache.tools.ant.types.RegularExpression
regexp=org.apache.tools.ant.types.RegularExpression

Loading…
Cancel
Save