Regexp represents a regular expression.
|pattern||regular expression pattern||Yes|
<regexp id="myregexp" pattern="alpha(.+)beta"/>
Defines a regular expression for later use with id
Use the regular expression with id
Apache Ant comes with wrappers for the java.util.regex package, jakarta-regexp and jakarta-ORO, see installation dependencies concerning the supporting libraries.
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
ant.regexp.regexpimpl is not defined, Ant uses Jdk14Regexp as this is always
There are cross-platform issues for matches related to line terminator. For example if you
$ 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.
\nand is consistent with Perl.
\u2029as a default but is configured in the wrapper to use only
We used to recommend that you use Jakarta ORO but since its development has been retired Java's built-in regex package is likely the best choice going forward.
These string filters also use the mechanism of regexp to choose a regular expression implementation: