@@ -139,7 +139,7 @@ public static boolean matchPatternStart(String pattern, String str, boolean isCa
139
139
}
140
140
}
141
141
142
- static boolean isAntPrefixedPattern (String pattern ) {
142
+ public static boolean isAntPrefixedPattern (String pattern ) {
143
143
return pattern .length () > (ANT_HANDLER_PREFIX .length () + PATTERN_HANDLER_SUFFIX .length () + 1 )
144
144
&& pattern .startsWith (ANT_HANDLER_PREFIX )
145
145
&& pattern .endsWith (PATTERN_HANDLER_SUFFIX );
@@ -243,17 +243,6 @@ public static boolean matchPath(String pattern, String str, String separator, bo
243
243
}
244
244
}
245
245
246
- public static String extractPattern (final String pattern , final String separator ) {
247
- if (isRegexPrefixedPattern (pattern )) {
248
- return pattern .substring (REGEX_HANDLER_PREFIX .length (), pattern .length () - PATTERN_HANDLER_SUFFIX .length ());
249
- } else {
250
- String localPattern = isAntPrefixedPattern (pattern )
251
- ? pattern .substring (ANT_HANDLER_PREFIX .length (), pattern .length () - PATTERN_HANDLER_SUFFIX .length ())
252
- : pattern ;
253
- return toOSRelatedPath (localPattern , separator );
254
- }
255
- }
256
-
257
246
private static String toOSRelatedPath (String pattern , String separator ) {
258
247
if ("/" .equals (separator )) {
259
248
return pattern .replace ("\\ " , separator );
@@ -719,4 +708,22 @@ public static String removeWhitespace(String input) {
719
708
}
720
709
return result .toString ();
721
710
}
711
+
712
+ /**
713
+ * Extract the pattern without the Regex or Ant prefix. In the case of Ant style matches ensure
714
+ * that the path uses specified separator.
715
+ * @param pattern the pattern to extract from.
716
+ * @param separator the system file name separator in the pattern.
717
+ * @return The pattern without the Regex or Ant prefix.
718
+ */
719
+ public static String extractPattern (final String pattern , final String separator ) {
720
+ if (isRegexPrefixedPattern (pattern )) {
721
+ return pattern .substring (REGEX_HANDLER_PREFIX .length (), pattern .length () - PATTERN_HANDLER_SUFFIX .length ());
722
+ } else {
723
+ String localPattern = isAntPrefixedPattern (pattern )
724
+ ? pattern .substring (ANT_HANDLER_PREFIX .length (), pattern .length () - PATTERN_HANDLER_SUFFIX .length ())
725
+ : pattern ;
726
+ return toOSRelatedPath (localPattern , separator );
727
+ }
728
+ }
722
729
}
0 commit comments