@@ -149,7 +149,7 @@ public static boolean matchPatternStart( String pattern, String str, boolean isC
149149 }
150150 }
151151
152- static boolean isAntPrefixedPattern ( String pattern )
152+ public static boolean isAntPrefixedPattern ( String pattern )
153153 {
154154 return pattern .length () > ( ANT_HANDLER_PREFIX .length () + PATTERN_HANDLER_SUFFIX .length () + 1 )
155155 && pattern .startsWith ( ANT_HANDLER_PREFIX ) && pattern .endsWith ( PATTERN_HANDLER_SUFFIX );
@@ -281,7 +281,7 @@ private static String toOSRelatedPath( String pattern, String separator )
281281 return pattern ;
282282 }
283283
284- static boolean isRegexPrefixedPattern ( String pattern )
284+ public static boolean isRegexPrefixedPattern ( String pattern )
285285 {
286286 return pattern .length () > ( REGEX_HANDLER_PREFIX .length () + PATTERN_HANDLER_SUFFIX .length () + 1 )
287287 && pattern .startsWith ( REGEX_HANDLER_PREFIX ) && pattern .endsWith ( PATTERN_HANDLER_SUFFIX );
@@ -834,4 +834,22 @@ public static String removeWhitespace( String input )
834834 }
835835 return result .toString ();
836836 }
837+
838+ /**
839+ * Extract the pattern without the Regex or Ant prefix.
840+ * @param pattern the pattern to extract from.
841+ * @param separator the file name separator in the pattern.
842+ * @return The pattern without the Regex or Ant prefix.
843+ */
844+ public static String extractPattern (final String pattern , final String separator ) {
845+ if (isRegexPrefixedPattern (pattern )) {
846+ return pattern .substring (
847+ REGEX_HANDLER_PREFIX .length (), pattern .length () - PATTERN_HANDLER_SUFFIX .length ());
848+ } else {
849+ String localPattern = isAntPrefixedPattern (pattern )
850+ ? pattern .substring (ANT_HANDLER_PREFIX .length (), pattern .length () - PATTERN_HANDLER_SUFFIX .length ())
851+ : pattern ;
852+ return toOSRelatedPath (localPattern , separator );
853+ }
854+ }
837855}
0 commit comments