[xpath2] committing a fix for fn:matches function. it was initially
reported here, https://issues.apache.org/jira/browse/XERCESJ-1640
diff --git a/bundles/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/AbstractRegExFunction.java b/bundles/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/AbstractRegExFunction.java
index e887ea6..b5a20c0 100644
--- a/bundles/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/AbstractRegExFunction.java
+++ b/bundles/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/AbstractRegExFunction.java
@@ -29,9 +29,19 @@
 	
 	protected static boolean matches(String pattern, String flags, String src) {
 		boolean fnd = false;
-		if (pattern.indexOf("-[") != -1) {
+		
+		/*if (pattern.indexOf("-[") != -1) {
 			pattern = pattern.replaceAll("\\-\\[", "&&[^");
+		} */
+		int indx1 = pattern.indexOf("-[");
+		if (indx1 != -1) {
+			String subsPrev = pattern.substring(0, indx1);
+			String subsAfter = pattern.substring(indx1 + 2);
+			if ((subsPrev.indexOf("[") != -1) && (subsAfter.indexOf("]]") != -1)) {
+				pattern = pattern.replaceAll("\\-\\[", "&&[^");	
+			}
 		}
+		
 		Matcher m = compileAndExecute(pattern, flags, src);
 		while (m.find()) {
 			fnd = true;