Class GlobbingPathHelper


  • public class GlobbingPathHelper
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String globPathAsRegex​(java.lang.String pathWithGlobs)
      Converts the provided path containing glob characters * and ** into a regular expression.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GlobbingPathHelper

        public GlobbingPathHelper()
    • Method Detail

      • globPathAsRegex

        public static java.lang.String globPathAsRegex​(java.lang.String pathWithGlobs)
        Converts the provided path containing glob characters * and ** into a regular expression. The definition matches that of the GlobbingPathFilter with the addition that this conversion also supports sub-paths which do not start with a /.

        The rules are:

        • leading ** matches /foo and bar
        • leading /** matches /foo but not bar
        • intermittent ** matches zero or any number of path elements
        • trailing ** matches anything not ending with a /
        • single * matches anything except /
        • ? is not a special character
        • anything not a star is wrapped into \Q...\E pairs
        Parameters:
        pathWithGlobs - path that can contain * and **
        Returns:
        a regular expression
        See Also:
        GlobbingPathFilter