Browse Source

add regexp attribute to linecontainsregexp

https://bz.apache.org/bugzilla/show_bug.cgi?id=60968
master
Stefan Bodewig 8 years ago
parent
commit
5347475984
3 changed files with 20 additions and 5 deletions
  1. +3
    -0
      WHATSNEW
  2. +6
    -1
      manual/Types/filterchain.html
  3. +11
    -4
      src/main/org/apache/tools/ant/filters/LineContainsRegExp.java

+ 3
- 0
WHATSNEW View File

@@ -15,6 +15,9 @@ Other changes:
values always get quoted.
Github Pull Request #32

* added "regexp" attribute to <linecontainsregexp>
Bugzilla Report 60968

Changes from Ant 1.9.8 TO Ant 1.9.9
===================================



+ 6
- 1
manual/Types/filterchain.html View File

@@ -422,7 +422,12 @@ regular expression matching strings.
</tr>
<tr>
<td vAlign=top>regexp</td>
<td vAlign=top align="center">Regular expression to be searched for.</td>
<td vAlign=top align="center">Regular expression to be searched for.<br>
<em>Starting with 1.9.10 this also works as an attribute
on <code>linecontainsregexp</code>, in earlier versions of Ant
you must use a nested element when using the convenience
method.</em>
</td>
<td vAlign=top align="center">Yes</td>
</tr>
<tr>


+ 11
- 4
src/main/org/apache/tools/ant/filters/LineContainsRegExp.java View File

@@ -219,6 +219,16 @@ public final class LineContainsRegExp
return negate;
}

/**
* Set the regular expression as an attribute.
* @since Ant 1.9.10
*/
public void setRegexp(String pattern) {
RegularExpression regexp = new RegularExpression();
regexp.setPattern(pattern);
regexps.addElement(regexp);
}

/**
* Parses parameters to add user defined regular expressions.
*/
@@ -227,10 +237,7 @@ public final class LineContainsRegExp
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (REGEXP_KEY.equals(params[i].getType())) {
String pattern = params[i].getValue();
RegularExpression regexp = new RegularExpression();
regexp.setPattern(pattern);
regexps.addElement(regexp);
setRegexp(params[i].getValue());
} else if (NEGATE_KEY.equals(params[i].getType())) {
setNegate(Project.toBoolean(params[i].getValue()));
} else if (CS_KEY.equals(params[i].getType())) {


Loading…
Cancel
Save