From 5ca341e1f47bd14887dbe1815d67a281c88c65d9 Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Mon, 24 Nov 2003 21:56:53 +0000 Subject: [PATCH] added details concerning the choice of the regular expression implementation. Also fixed an example, the substitution tag accepts the attribute expression, not pattern. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275677 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/OptionalTasks/replaceregexp.html | 76 ++++++++++++-------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/docs/manual/OptionalTasks/replaceregexp.html b/docs/manual/OptionalTasks/replaceregexp.html index eca4f2027..dec669b85 100644 --- a/docs/manual/OptionalTasks/replaceregexp.html +++ b/docs/manual/OptionalTasks/replaceregexp.html @@ -4,10 +4,9 @@ ReplaceRegExp Task - -

ReplaceRegExp

+

ReplaceRegExp

Description

ReplaceRegExp is a directory based task for replacing the occurrence of a given regular expression with a substitution pattern @@ -20,28 +19,7 @@ have been regenerated by this task.

Similar to regexp type mappers this task needs a supporting regular expression library and an implementation of -org.apache.tools.ant.util.regexp.Regexp. Ant comes with -implementations for -the java.util.regex package of JDK 1.4, -jakarta-regexp -and jakarta-ORO, -but you will still need the library itself.

-

- -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. -

-We strongly recommend that you use Jakarta Oro. - -

+org.apache.tools.ant.util.regexp.Regexp. See details below.

Parameters

@@ -74,6 +52,7 @@ We strongly recommend that you use Jakarta Oro. i : Case Insensitive. Do not consider case in the match
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.
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.
+ @@ -100,6 +79,47 @@ We strongly recommend that you use Jakarta Oro.

replaces occurrences of the property name "OldProperty" with "NewProperty" in a properties file, preserving the existing value, in the file ${src}/build.properties

+ +

Choice of regular expression implementation

+

+Ant comes with +wrappers for +the java.util.regex package of JDK 1.4, +jakarta-regexp +and jakarta-ORO, +See installation dependencies + concerning the supporting libraries.

+

+The system property ant.regexp.regexpimpl governs which regular expression implementation will be chosen. +Possible values for this property are : +

+It can also be another implementation of the interface org.apache.tools.ant.util.regexp.Regexp. +If ant.regexp.regexpimpl 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.

+

+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. +

+We strongly recommend that you use Jakarta Oro. +

Parameters specified as nested elements

This task supports a nested FileSet element.

@@ -107,14 +127,14 @@ value, in the file ${src}/build.properties

the regular expression. You can use this element to refer to a previously defined regular expression datatype instance.

- <regexp id="id" pattern="expression"/>
+ <regexp id="id" pattern="alpha(.+)beta"/>
<regexp refid="id"/>

This task supports a nested Substitution element to specify the substitution pattern. You can use this element to refer to a previously defined substitution pattern datatype instance.

- <substitution id="id" pattern="expression"/>
+ <substitution id="id" expression="beta\1alpha"/>
<substitution refid="id"/>

Examples

@@ -151,8 +171,8 @@ would converted to <html> <body> <h1> T E S T </h1> </body></html> - -
+

+

Copyright © 2001-2003 Apache Software Foundation. All rights Reserved.

No