Author: mbenson
Date: Fri Feb 26 17:29:20 2010
New Revision: 916767
URL: http://svn.apache.org/viewvc?rev=916767&view=rev
Log:
document regex
Modified:
ant/antlibs/props/trunk/src/main/org/apache/ant/props/ConditionEvaluator.java
Modified:
ant/antlibs/props/trunk/src/main/org/apache/ant/props/ConditionEvaluator.java
URL:
http://svn.apache.org/viewvc/ant/antlibs/props/trunk/src/main/org/apache/ant/props/ConditionEvaluator.java?rev=916767&r1=916766&r2=916767&view=diff
==============================================================================
---
ant/antlibs/props/trunk/src/main/org/apache/ant/props/ConditionEvaluator.java
(original)
+++
ant/antlibs/props/trunk/src/main/org/apache/ant/props/ConditionEvaluator.java
Fri Feb 26 17:29:20 2010
@@ -40,11 +40,33 @@
private static final Pattern COMMA = Pattern.compile(",");
private static final Pattern EQ = Pattern.compile("=");
+ private static final String PATTERN = "^" // beginning
+ + "(!)?" // optional bang implying NOT
+ + "(.+?)" // reluctant one-or-more characters !LPAREN (see next)
+ + "\\(" // LPAREN
+ + "(" // capturing group 1
+ + "(?:" // noncapturing group for first attribute assignment
+ + "(?:.+?)" // reluctant one or more !=
+ + "=" // equals
+ + "(?:.+?)" // reluctant one or more !,
+ + ")?" //
+ + "(?:" // noncapturing group of additional attribute assignments
+ + "," // delimiting comma
+ + "(?:.+?)" // noncapturing reluctant 1 or more !=
+ + "=" // equals
+ + "(?:.+?)" // noncapturing reluctant 1 or more
+ + ")*" // 0 or more additional attributes
+ + "?" // 0 or 1 sets of attributes
+ + ")" // end capturing group 1
+ + "\\)" // RPAREN
+ + "$" // EOF
+ ;
+
/**
* Create a new ConditionEvaluator instance.
*/
public ConditionEvaluator() {
- super("^(!)?(.+?)\\(((?:(?:.+?)=(?:.+?))?(?:,(?:.+?)=(?:.+?))*?)\\)$");
+ super(PATTERN);
}
/**